webpack生成环境移除console
1.首先安装 babel-plugin-transform-remove-console
插件
base
1 yarn add babel-plugin-transform-remove-console
2.找到根目录babel.config.js
添加如下
javascript
1 const plugins = ["@vue/babel-plugin-transform-vue-jsx"] 2 // 生产环境移除console 3 if (process.env.NODE_ENV === 'production') { 4 plugins.push("transform-remove-console") 5 } 6 module.exports = { 7 plugins: plugins, 8 presets: [ 9 '@vue/cli-plugin-babel/preset' 10 ] 11 } 12
阅读量:2363发布日期:2021-06-11 10:51:03
博客描述
vue项目需要在生产环境去掉开发中的断点和调试,保证代码安全性!