Skip to content

Commit

Permalink
maint: mini-css-extract-plugin prints too many logs in console
Browse files Browse the repository at this point in the history
The solution originates from webpack-contrib/mini-css-extract-plugin#168
  • Loading branch information
KKoukiou committed Jan 27, 2020
1 parent 48e2bb1 commit ae18081
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,27 @@ info.files.forEach(function(value) {
});
info.files = files;

// Hide mini-css-extract-plugin spam logs
class CleanUpStatsPlugin {
shouldPickStatChild(child) {
return child.name.indexOf('mini-css-extract-plugin') !== 0;
}

apply(compiler) {
compiler.hooks.done.tap('CleanUpStatsPlugin', (stats) => {
const children = stats.compilation.children;
if (Array.isArray(children)) {
stats.compilation.children = children
.filter(child => this.shouldPickStatChild(child));
}
});
}
}

var plugins = [
new copy(info.files),
new miniCssExtractPlugin("[name].css"),
new CleanUpStatsPlugin(),
];

var output = {
Expand Down

0 comments on commit ae18081

Please sign in to comment.