vue cli3 去除 console

Easter79
• 阅读 486

原文链接: vue cli3 去除 console

https://www.npmjs.com/package/babel-plugin-transform-remove-console

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

.babelrc

// with options

{

  "plugins": [ ["transform-remove-console", { "exclude": [ "error", "warn"] }] ]

}


// without options

{

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

}

安装 transform-remove-console
修改 babel.config.js

const plugins = []
if (process.env.NODE_ENV === 'production') {
  plugins.push('transform-remove-console')
}

module.exports = {
  presets: [
    '@vue/app'
  ],
  plugins
}
点赞
收藏
评论区
推荐文章
Easter79 Easter79
2年前
vue 提交前进行代码检查和修复
原文链接: vue提交前进行代码检查和修复(https://my.oschina.net/ahaoboy/blog/3143790)安装npminstallhuskysavedevnpminstallprecommitsavedevyarnadd
Easter79 Easter79
2年前
tesseract ocr node api使用
原文链接: tesseractocrnodeapi使用(https://my.oschina.net/ahaoboy/blog/4650445)安装https://github.com/UBMannheim/tesseract/wiki(https://www.oschina.net/action/GoToLink?urlhttps
Stella981 Stella981
2年前
LeetCode 1009. 十进制整数的反码
原文链接: LeetCode1009.十进制整数的反码(https://my.oschina.net/ahaoboy/blog/3118044)https://leetcodecn.com/problems/complementofbase10integer/(https://www.oschina.net/action/GoToL
Stella981 Stella981
2年前
Python 学生管理
原文链接: Python学生管理(https://my.oschina.net/ahaoboy/blog/1526102)python3练手 codingutf8学生类classStu:三个字段id字符串,name字符串,score小数def__init__(sel
Stella981 Stella981
2年前
LeetCode 169. 求众数
原文链接: LeetCode169.求众数(https://my.oschina.net/ahaoboy/blog/3118038)https://leetcodecn.com/problems/majorityelement/(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F
Stella981 Stella981
2年前
LeetCode 72. 编辑距离
原文链接: LeetCode72.编辑距离(https://my.oschina.net/ahaoboy/blog/3113850)https://leetcodecn.com/problems/editdistance/(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2F
Stella981 Stella981
2年前
LeetCode 338. 比特位计数
原文链接: LeetCode338.比特位计数(https://my.oschina.net/ahaoboy/blog/3117631)https://leetcodecn.com/problems/countingbits/(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%
Stella981 Stella981
2年前
LeetCode 生命游戏,不用新数组的方式
原文链接: LeetCode生命游戏,不用新数组的方式(https://my.oschina.net/ahaoboy/blog/4958278)https://leetcodecn.com/problems/gameoflife/(https://www.oschina.net/action/GoToLink?urlhttps%3A%2
Wesley13 Wesley13
2年前
lz
原文链接: lzstring面向localstorage的字符串压缩库(https://my.oschina.net/ahaoboy/blog/4696653)https://www.npmjs.com/package/lzstring(https://www.oschina.net/action/GoToLink?urlhttps%3A
Stella981 Stella981
2年前
Promise和worker内存泄漏的问题
原文链接: Promise和worker内存泄漏的问题(https://my.oschina.net/ahaoboy/blog/4718123)https://www.cnblogs.com/cangqinglang/p/10580297.html(https://www.oschina.net/action/GoToLink?urlhttps
Easter79
Easter79
Lv1
今生可爱与温柔,每一样都不能少。
文章
2.8k
粉丝
5
获赞
1.2k