在build/webpack.prod.conf.js里面

添加如下代码

const webpackConfig = merge(baseWebpackConfig, {
    plugins: [
       new webpack.optimize.UglifyJsPlugin({ //自动删除console.log
          compress: {
            warnings: false,
            drop_debugger: true,
            drop_console: true,
            pure_funcs: ['console.log']
          },
          sourceMap: true,
          parallel: true,
        }),    
    ]

})

vue-cli 2.x项目,删除打包线上环境的控制台打印

相关文章:

  • 2021-12-07
  • 2021-05-17
  • 2022-02-08
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2021-07-03
  • 2021-07-11
相关资源
相似解决方案