1.安装依赖
1 npm install babel-plugin-transform-remove-console --save-dev
2.在babel.config.js
// 项目发布结局需要用到的babel插件 const prodPlugins = [] if (process.env.NODE_ENV === 'production') { prodPlugins.push('transform-remove-console') } module.exports = { plugins: prodPlugins, presets: [ '@vue/app' ] }