NoErrorsPlugin.js 734 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. let deprecationReported = false;
  7. class NoErrorsPlugin {
  8. apply(compiler) {
  9. compiler.plugin("should-emit", (compilation) => {
  10. if(!deprecationReported) {
  11. compilation.warnings.push("webpack: Using NoErrorsPlugin is deprecated.\n" +
  12. "Use NoEmitOnErrorsPlugin instead.\n");
  13. deprecationReported = true;
  14. }
  15. if(compilation.errors.length > 0)
  16. return false;
  17. });
  18. compiler.plugin("compilation", (compilation) => {
  19. compilation.plugin("should-record", () => {
  20. if(compilation.errors.length > 0)
  21. return false;
  22. });
  23. });
  24. }
  25. }
  26. module.exports = NoErrorsPlugin;