在vue.config.js中添加下面的代码即可
1 // vue-cli version > 3 2 modeule.exports = { 3 configureWebpack: config => { 4 if (process.env.NODE_ENV === "production") { 5 config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true; 6 } 7 }, 8 }