在vue.config.js(没有的话就在项目目录新建一个)中写入
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
configureWebpack: {
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: {
drop_console: true,
drop_debugger: false,
pure_funcs: ['console.log'] // 移除console
}
},
}),
]
}
},
}
网友评论