Files
hb_pqs_web/babel.config.js
2025-01-09 19:02:44 +08:00

24 lines
856 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}