openks / learn-vue

自定义组件文档
https://openks.github.io/learn-vue
0 stars 0 forks source link

20171101_webpack发布环境关闭console #60

Open openks opened 7 years ago

openks commented 7 years ago

只需修改webpack的配置文件即可关闭生产环境console

//build/webpack.prod.env.js
new webpack.optimize.UglifyJsPlugin({
  compress: {
    warnings: false,
    drop_console: true,//默认关闭所有console
    pure_funcs: ['console.log']//配置需关闭的console 如果不配置默认关闭全部 如果配置则只关闭已经配置的
  },
  sourceMap: false
})

相关连接:
https://jeffjade.com/2017/08/06/124-webpack-packge-optimization-for-volume/
webapck配置