1.Vue
插件安装:
npm install babel-plugin-transform-remove-console --save-dev
使用:babel.config.js
// 项目在发布时需要用到的babel插件数组
const proPlugins = [];
// 如果当前是生产环境,则使用去掉console的插件
if (process.env.NODE_ENV === 'production') {
proPlugins.push('transform-remove-console');
}
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [
...proPlugins
]
}
2.React
在config/webpack.config.js,搜索 optimization,如下。
{{{width=“100px” height=“auto”}}}
修改保存即可。