前言
create-react-app创建的react项目打包后我们需要过滤调试和打印信息
解决方案
1.找到文件(忘记了需不需要eject,没有就执行npm run eject)
webpack.config.js
2.ctrl+f寻找compress
compress: {
ecma: 5,
warnings: false,
comparisons: false,
inline: 2,
//配置的生成环境过滤debugger调试
drop_debugger: true,
//配置的生成环境过滤console消息
drop_console: true
},
3.主要代码
//配置的生成环境过滤debugger调试
drop_debugger: true,
//配置的生成环境过滤console消息
drop_console: true
网友评论