简体   繁体   中英

Disable Babel compilation details in create-react-app 5.0.0

After updating react-scripts (Create React App) to 5.0.0, when running npm start command in terminal, it adds a bunch of compilation logs:

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

This behaviour is not observed in react-scripts version 4. Is there any chance to remove this information from the terminal?

After tinkering with with CRA settings, I found a dirty hack to make console clean again - go to node_modules/react-scripts/config/webpack.config.js and at the very end of the config object add stats: none . This will bring back old-school terminal development logs without that web pack chunks rubbish

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM