admin管理员组文章数量:1313133
I am trying to get Vite and babel to play nicely together upon running the dev server so I downloaded this Vite plugin.
In my vite.config.ts
, I should add:
plugins: [
babel({
babelConfig: // what do I put here?
})
],
I don't know what to put in the babelConfig
property. The docs say that I should include the .babelrc
or .babelrc.json
but what if I have a babel.config.js
instead? The reason I have a JS file is because I want to switch off of (or use ternary operators) for process.env.NODE_ENV
or other environment variables.
babel.config.js
module.exports = function (api) {
api.cache(true)
switch(process.env.NODE_ENV) {
case: 'docker':
return { plugins: [...], presets: [...] }
case: 'development':
return { plugins: [...], presets: [...] }
case: 'stage':
return { plugins: [...], presets: [...] }
case: 'production':
default:
return { plugins: [...], presets: [...] }
}
}
Any idea on what I should pass to the babel plugin for Vite to use my babel.config.js
?
本文标签: babeljsUsing babel plugin in Vite with babelconfigjsStack Overflow
版权声明:本文标题:babeljs - Using babel plugin in Vite with babel.config.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741921476a2405029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论