Skip to content

Instantly share code, notes, and snippets.

@Akiyamka
Created July 5, 2020 21:03
Show Gist options
  • Save Akiyamka/ecc3262fdfc14b2010bea3595d1515e3 to your computer and use it in GitHub Desktop.
Save Akiyamka/ecc3262fdfc14b2010bea3595d1515e3 to your computer and use it in GitHub Desktop.
Allow mute spam from other plugins
/**
* @param {Object} child
* @param {string} child.name
* @returns {boolean}
*/
class MutePlugin {
constructor(pluginNameSubstring) {
this.pluginNameSubstring = pluginNameSubstring;
}
shouldShow(child) {
return !child.name.includes(this.pluginNameSubstring);
}
apply(compiler) {
compiler.plugin('done', stats => {
if (Array.isArray(stats.compilation.children)) {
stats.compilation.children = stats.compilation.children.filter(child => this.shouldShow(child));
}
});
}
}
module.exports = MutePlugin;
module.exports = {
plugins: [
new MutePlugin('mini-css-extract-plugin'),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment