From d8157b13585d595c0563788c1923dd3fae9b0071 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Fri, 12 Jul 2019 13:14:06 -0700 Subject: [PATCH] fix(plugin-webpack): check that stats is not empty before sending to multi-logger --- packages/plugin/webpack/src/WebpackPlugin.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/plugin/webpack/src/WebpackPlugin.ts b/packages/plugin/webpack/src/WebpackPlugin.ts index d31b75700c..7a4ef917c0 100644 --- a/packages/plugin/webpack/src/WebpackPlugin.ts +++ b/packages/plugin/webpack/src/WebpackPlugin.ts @@ -360,7 +360,7 @@ Your packaged app may be larger than expected if you dont ignore everything othe const compiler = webpack(await this.getMainConfig()); const [onceResolve, onceReject] = once(resolve, reject); const cb: webpack.ICompiler.Handler = (err, stats) => { - if (tab) { + if (tab && stats) { tab.log(stats.toString({ colors: true, })); @@ -443,9 +443,11 @@ Your packaged app may be larger than expected if you dont ignore everything othe const tab = logger.createTab(`${entryPoint.name} - Preload`); const [onceResolve, onceReject] = once(resolve, reject); const cb: webpack.ICompiler.Handler = (err, stats) => { - tab.log(stats.toString({ - colors: true, - })); + if (stats) { + tab.log(stats.toString({ + colors: true, + })); + } if (err) return onceReject(err); return onceResolve();