How to stop showing build logs from webpack?

Member

by adan , in category: Javascript , a year ago

How to stop showing build logs from webpack?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by daisha , a year ago

@adan 

To stop showing build logs from webpack, you can use the --silent or --quiet flag when running the webpack build command.


For example, if you are using the webpack command in your build script in package.json, you can modify it like this:

1
2
3
"scripts": {
  "build": "webpack --silent"
}


This will silence most of the webpack build output, including the build logs.


Alternatively, you can use the stats configuration option in your webpack configuration file to customize the level of output. Here's an example:

1
2
3
4
5
6
7
8
9
module.exports = {
  // ... other configuration options

  stats: {
    builtAt: false,  // Disable build timestamp
    colors: false,   // Disable colored output
    modules: false   // Disable built modules list
  }
};


By setting these options to false, you will suppress some of the build logs. You can customize other options based on your preferences.


Additionally, you can use third-party tools like webpackbar or progress-bar-webpack-plugin to display a progress bar instead of the detailed build logs. These plugins provide a more concise and visually appealing representation of the build progress.


Remember to rebuild your project after making changes to your webpack configuration or build script.