vue_cli3 打包去除console.log

1.npm install babel-plugin-transform-remove-console --save-dev
2.根目录加:babel.config.js

const plugins = []
if (process.env.NODE_ENV === 'production') {
  plugins.push('transform-remove-console');
}
module.exports = {
  presets: [
    '@vue/app'
  ],
  plugins: plugins
}
posted @ 2020-10-30 17:32  米牙  阅读(485)  评论(0编辑  收藏  举报