vue 自动去除console.log()

93 阅读1分钟

使用 Babel 插件 babel-plugin-transform-remove-console

1.安装 babel-plugin-transform-remove-console 插件。 npm install babel-plugin-transform-remove-console --save-dev 2.Babel 配置文件(通常是 .babelrc 或 babel.config.js)中添加该插件。 在生产环境中启用: { "env": { "production": { "plugins": ["transform-remove-console"] } } }

image.png