在本地测试时可以打印console.log,打包之后不打印
在build下的webpack.prod.conf.js中添加
drop_console: true
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
drop_debugger: true, //打包之后关闭debugger
drop_console: true // 打包之后关闭console.log
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),