index.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _webpackModuleError = require("./webpackModuleError");
  6. const NAME = "WellKnownErrorsPlugin";
  7. class WellKnownErrorsPlugin {
  8. apply(compiler) {
  9. compiler.hooks.compilation.tap(NAME, (compilation)=>{
  10. compilation.hooks.afterSeal.tapPromise(NAME, async ()=>{
  11. var ref;
  12. if ((ref = compilation.errors) == null ? void 0 : ref.length) {
  13. await Promise.all(compilation.errors.map(async (err, i)=>{
  14. try {
  15. const moduleError = await (0, _webpackModuleError).getModuleBuildError(compilation, err);
  16. if (moduleError !== false) {
  17. compilation.errors[i] = moduleError;
  18. }
  19. } catch (e) {
  20. console.log(e);
  21. }
  22. }));
  23. }
  24. });
  25. });
  26. }
  27. }
  28. exports.WellKnownErrorsPlugin = WellKnownErrorsPlugin;
  29. //# sourceMappingURL=index.js.map