Files
hb_pqs_web/babel.config.js

24 lines
856 B
JavaScript
Raw Permalink Normal View History

2025-01-09 19:02:44 +08:00
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
}