Created
July 5, 2020 21:03
-
-
Save Akiyamka/ecc3262fdfc14b2010bea3595d1515e3 to your computer and use it in GitHub Desktop.
Allow mute spam from other plugins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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