![](/img/trans.png)
[英]How can remove console.log in the production build of a React application created using create-react-app?
[英]how to remove console.log during production in reactjs created with `create-react-app`
我已經使用 npx create-react-app
我想在生產過程中刪除console.log()
但我用谷歌搜索我發現這個babel-plugin-transform-remove-console
插件是使用這個鏈接配置的https://babeljs.io/ docs/en/babel-plugin-transform-remove-console/#via-babelrc-recommended不幸的是,它對我來說似乎沒有鍛煉。 注意我在我的根目錄中手動創建 .babelrc 文件。
npm run eject
"babel": { "presets": [ "react-app" ], "env": { "production": { "plugins": [ "transform-remove-console" ] } } }
npm run build
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.