插件名: babel-plugin-transfrom-remove-console

运行安装命令:

npm install babel-plugin-transform-remove-console --save-dev

如果是vue-cli4版本的脚手架工具,直接打开babel.config.js 文件在plugins 中添加

 'plugins': [
    "transform-remove-console"
  ]

具体配置:

const prodPlugins = []
// 如果是发布模式则启用的插件
if (process.env.NODE_ENV === 'production') {
  prodPlugins.push('transform-remove-console')
}

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: [
    ...prodPlugins
  ]
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2021-07-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2021-06-01
  • 2021-08-04
  • 2021-11-01
相关资源
相似解决方案