在 build -> webpack.prod.conf.js 中添加
drop_console: true,
pure_funcs: ['console.log']
完整代码:
plugins: [
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
drop_console: true,
pure_funcs: ['console.log']
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
})
]