webpack打包到线上配置去掉console

修改webpack.prod.conf.js文件中的UglifyJsPlugin插件配置:

new UglifyJsPlugin({
  uglifyOptions: {
    compress: {
      warnings: false,
      drop_debugger: true,  //去掉debugger
      drop_console: true,  // 去掉console
      pure_funcs: ['console.log']// 移除console
    }
  },
  sourceMap: config.build.productionSourceMap,
  parallel: true
})

你可能感兴趣的:(webpack打包到线上配置去掉console)