From fc6c2c05a84bbdd1baf4f89e5ea69a690e463a3b Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Thu, 26 Nov 2020 17:36:51 +0000 Subject: [PATCH] propagate compilation error(s) to webpack --- plugin.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/plugin.js b/plugin.js index 5c357b3..92db18d 100644 --- a/plugin.js +++ b/plugin.js @@ -75,20 +75,11 @@ class WasmPackPlugin { }); }); - let first = true; - compiler.hooks.thisCompilation.tap('WasmPackPlugin', (compilation) => { - // Super hacky, needed to workaround a bug in Webpack which causes - // thisCompilation to be triggered twice on the first compilation. - if (first) { - first = false; - - } else { - // This is needed in order to gracefully handle errors in Webpack, - // since Webpack has its own custom error system. - if (this.error != null) { - compilation.errors.push(this.error); - } + // This is needed in order to gracefully handle errors in Webpack, + // since Webpack has its own custom error system. + if (this.error != null) { + compilation.errors.push(this.error); } }); }