[英]Disable Babel compilation details in create-react-app 5.0.0
將react-scripts
(Create React App)更新到 5.0.0 后,在終端運行npm start
命令時,它會添加一堆編譯日志:
Compiled successfully!
You can now view product-list-dashboard in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.1.2:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
assets by status 1.1 KiB [cached] 1 asset
assets by chunk 1.63 MiB (name: main)
asset static/js/bundle.js 1.62 MiB [emitted] (name: main) 1 related asset
asset main.7ab1960ed887a618980d.hot-update.js 11.3 KiB [emitted] [immutable] [hmr] (name: main) 1 related asset
assets by path *.json 431 bytes
asset asset-manifest.json 403 bytes [emitted]
asset main.7ab1960ed887a618980d.hot-update.json 28 bytes [emitted] [immutable] [hmr]
asset index.html 376 bytes [emitted]
Entrypoint main 1.63 MiB (1.55 MiB) = static/js/bundle.js 1.62 MiB main.7ab1960ed887a618980d.hot-update.js 11.3 KiB 3 auxiliary assets
cached modules 1.41 MiB [cached] 127 modules
runtime modules 28.2 KiB 13 modules
javascript modules 7.33 KiB
./src/App.js 5.58 KiB [built] [code generated]
./src/productList.js 1.75 KiB [built] [code generated]
webpack 5.65.0 compiled successfully in 522 ms
在react-scripts
版本 4 中未觀察到此行為。是否有機會從終端中刪除此信息?
在修改了 CRA 設置之后,我發現了一個骯臟的 hack 來再次使控制台干凈 - go 到node_modules/react-scripts/config/webpack.config.js
並在配置 object 的最后添加stats: none
。 這將帶回沒有 web 包塊垃圾的老式終端開發日志
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.