From 07155b9c1c8a0f72563f83d6e6f743fa6006bdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20van=20der=20Sande?= Date: Wed, 16 Sep 2020 15:00:41 +0200 Subject: [PATCH] Allow usage of array of configs for webpack --- src/devServer.js | 6 ++++++ src/webpackUtils.js | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/devServer.js b/src/devServer.js index 187cd7b5..eb53a81a 100644 --- a/src/devServer.js +++ b/src/devServer.js @@ -17,6 +17,12 @@ export default function devServer(webpackConfig, serverConfig, url, cb) { let {host, open, port, ...otherServerConfig} = serverConfig + // In case of an array of config, use the first config + // as the 'default' config for public path extraction + if (Array.isArray(webpackConfig)) { + webpackConfig = webpackConfig[0] + } + let webpackDevServerOptions = merge({ headers: { 'Access-Control-Allow-Origin': '*' diff --git a/src/webpackUtils.js b/src/webpackUtils.js index 6fe730c3..d96a7da2 100644 --- a/src/webpackUtils.js +++ b/src/webpackUtils.js @@ -82,6 +82,14 @@ function getFileDetails(stats) { } export function logBuildResults(stats, spinner) { + // In case of a MultiStats instance, run the function individually for each embedded stat + if (stats.stats) { + stats.stats.forEach((s) => { + logBuildResults(s) + }) + return + } + if (stats.hasErrors()) { if (spinner) { spinner.fail()