'Webpack console output

My webpack output console log is this:

$ webpack --progress --config webpack.config.test.js
{ NODE_ENV: 'development' }
{ WEBPACK_BUNDLE: true, WEBPACK_BUILD: true }
assets by status 1.46 MiB [cached] 8 assets
assets by path . 1.58 KiB
  asset css/styles.css 1.01 KiB [compared for emit] (name: main) 1 related asset
  asset index.html 584 bytes [compared for emit]
Entrypoint main 543 KiB (1.58 MiB) = runtime.0a95cdc1c076b6c7fd14.js 6.7 KiB vendors.8175084d63678640b295.js 532 KiB css/styles.css 1.01 KiB main.cd02394e31eece531e82.js 3.54 KiB 9 auxiliary assets
runtime modules 3.39 KiB 7 modules
cacheable modules 533 KiB (javascript) 568 bytes (css/mini-extract)
  javascript modules 533 KiB
    modules by path ../ 531 KiB
      ../node_modules/lodash/lodash.js 531 KiB [built] [code generated]
      ../css/app.css 50 bytes [built] [code generated]
      ../css/app1.css 50 bytes [built] [code generated]
    modules by path ./*.js 1.43 KiB
      ./index.js 1.03 KiB [built] [code generated]
      ./testC.js 409 bytes [built] [code generated]
  css modules 568 bytes
    css ../node_modules/css-loader/dist/cjs.js!../css/app.css 522 bytes [built] [code generated]
    css ../node_modules/css-loader/dist/cjs.js!../css/app1.css 46 bytes [built] [code generated]
webpack 5.47.0 compiled successfully in 1178 ms
Done in 2.12s.

I want this structure

Hash: aaaf5afc6582f3222f55
Version: webpack 1.12.14
Time: 1175ms
   Asset    Size  Chunks             Chunk Names
index.js  677 kB       0  [emitted]  main
chunk    {0} index.js (main) 643 kB [rendered]
    [0] ./src/app.js 574 bytes {0} [built] [1 error]
    [1] ./~/react/react.js 56 bytes {0} [built]
    [2] ./~/react/lib/React.js 1.49 kB {0} [built]
    [3] ./~/react/lib/ReactDOM.js 3.71 kB {0} [built]
    [4] ./~/process/browser.js 2.06 kB {0} [built]

Iam using webpack 5.0



Solution 1:[1]

I was also looking to make this output less noisy.

In our codebase we have

console.info(stats.toString(config.stats)), where stats is of type Configuration

If you have something similar you can change the formatting instead of doing a plain .toString()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Damian Green