From 898a486315a9e2762208c6b95b439751928e1ec7 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 21 Apr 2021 10:54:44 -0400 Subject: [PATCH] fix(@angular-devkit/build-angular): always inject live reload client when using live reload The current stable version of `webpack-dev-server` does not fully handle Webpack 5's configuration options. In this case, the `target` option can now be an array. However, the array form is ignored by the dev server which can cause the live reload client code to not be included in the output bundles. To remedy this, the `injectClient` option is used when live reload is enabled which forces the client code to be included regardless of the `target` option. (cherry picked from commit 85ce5ec3b0a4edb466967cb663911d2de780af0c) --- .../build_angular/src/webpack/configs/dev-server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/angular_devkit/build_angular/src/webpack/configs/dev-server.ts b/packages/angular_devkit/build_angular/src/webpack/configs/dev-server.ts index 50466b039638..db4da55fd6e5 100644 --- a/packages/angular_devkit/build_angular/src/webpack/configs/dev-server.ts +++ b/packages/angular_devkit/build_angular/src/webpack/configs/dev-server.ts @@ -121,6 +121,7 @@ export function getDevServerConfig( inline: hmr, publicPath: servePath, liveReload, + injectClient: liveReload, hotOnly: hmr && !liveReload, hot: hmr, proxy: addProxyConfig(root, proxyConfig),