From 508ae114d81b206f90892d7cf37a0b9c7624e688 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Tue, 12 Feb 2019 23:32:05 -0800 Subject: [PATCH] fix(plugin-webpack): throw an error if webpack generates compilation errors when packaging ISSUES CLOSED: #579 --- packages/plugin/webpack/src/WebpackPlugin.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/plugin/webpack/src/WebpackPlugin.ts b/packages/plugin/webpack/src/WebpackPlugin.ts index cce70826dd..d137dc5d25 100644 --- a/packages/plugin/webpack/src/WebpackPlugin.ts +++ b/packages/plugin/webpack/src/WebpackPlugin.ts @@ -285,6 +285,10 @@ Your packaged app may be larger than expected if you dont ignore everything othe } if (err) return onceReject(err); + if (!watch && stats.hasErrors()) { + return onceReject(new Error(`Compilation errors in the main process: ${stats.toString()}`)); + } + onceResolve(); }; if (watch) { @@ -301,6 +305,10 @@ Your packaged app may be larger than expected if you dont ignore everything othe await new Promise(async (resolve, reject) => { webpack(await this.getRendererConfig(this.config.renderer.entryPoints)).run((err, stats) => { if (err) return reject(err); + if (!watch && stats.hasErrors()) { + return reject(new Error(`Compilation errors in the renderer: ${stats.toString()}`)); + } + resolve(); }); });