When webpack is running, how can you prevent the console from displaying these messages?

Jun.29,2021

add stats: "none" to webpack.config.js;

View the document


stats: {
chunks: false, / / do not add chunk information
colors: true,
modules: false, / / do not add building module information

}


has finally solved this problem after searching for it for a long time. On my side, I use webpack-dev-middleware to build the development environment. Adding options to stats: 'errors-only' will not output this information.

    var compiler = webpack(webpackConfig);
    var devMiddleware = require('webpack-dev-middleware')(compiler, {
      publicPath: '/',
      stats: 'errors-only', // 
      quiet: true //turn off errors to work with friendly-errors-webpack-plugin
    });
The

stats option gives you more precise control over how bundle information is displayed. If you do not want to use quiet or noInfo , but do not want to get all the information, but just want to get some bundle information, use the stats option is a better way

if you are using webpack-dev-server , this attribute should be placed in the devServer configuration object .
for webpack-dev-middleware , this attribute needs to be in the options object of webpack-dev-middleware.

reference link: idebar/Sidebar.jsx" rel=" nofollow noreferrer "> stats object-webpack

Menu