Created
November 10, 2016 15:20
-
-
Save matt-hensley/46ae283b6a84c5a5bf7f3c0b98daa8f0 to your computer and use it in GitHub Desktop.
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
var SuppressWarningPlugin = function (warningName, moduleName) { | |
this.warningName = warningName; | |
this.moduleName = moduleName; | |
}; | |
SuppressWarningPlugin.prototype.apply = function (compiler) { | |
var warningName = this.warningName; | |
var moduleName = this.moduleName; | |
compiler.plugin("emit", function (compilation, callback) { | |
if (compilation && compilation.warnings && compilation.warnings.length) { | |
compilation.warnings = compilation.warnings.filter(function (warning) { | |
if (warning.name !== warningName) return true; | |
return !(warning.origin && warning.origin.rawRequest === moduleName); | |
}); | |
} | |
callback(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment