提交
This commit is contained in:
23
babel.config.js
Normal file
23
babel.config.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const prodPlugins = [];
|
||||
// 判断是否为生产环境
|
||||
if (['production', 'prod'].includes(process.env.NODE_ENV)) {
|
||||
// { 'exclude': [ 'error', 'warn'] } :允许打印 error、warn 类型的日志
|
||||
// 如果需要允许打印log, 则在exclude配置中添加参数 'log' 即可
|
||||
// 若没有exclude参数,则表示禁止打印所以日志
|
||||
prodPlugins.push(['transform-remove-console', { 'exclude': ['error', 'warn'] }]);
|
||||
}
|
||||
|
||||
const prodPlugins1 = []
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
prodPlugins.push('transform-remove-console')
|
||||
}
|
||||
module.exports = {
|
||||
presets: [
|
||||
['@vue/app', {
|
||||
useBuiltIns: 'usage'
|
||||
}]
|
||||
],
|
||||
plugins: ['@babel/plugin-transform-modules-commonjs','@babel/plugin-proposal-optional-chaining',
|
||||
'@babel/plugin-proposal-nullish-coalescing-operator'],
|
||||
...prodPlugins1
|
||||
}
|
||||
Reference in New Issue
Block a user