[英]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.