需要在webpack.prod.conf.js里面加上一句代码就可以了
plugins: [
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
+ drop_console: true, // 不打印console
+ pure_funcs: ['console.log'] // 移除console
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
]