From d9f73d76dabc6d8d6baa7e1ef4f401cbcb604017 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 28 Sep 2018 10:58:07 -0400 Subject: [PATCH] fix(@angular-devkit/build-angular): only process index HTML if option is used --- .../models/webpack-configs/browser.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts index eccf8ad71b93..aa5483b6bb1a 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts @@ -39,6 +39,17 @@ export function getBrowserConfig(wco: WebpackConfigOptions) { } } + if (buildOptions.index) { + extraPlugins.push(new IndexHtmlWebpackPlugin({ + input: path.resolve(root, buildOptions.index), + output: path.basename(buildOptions.index), + baseHref: buildOptions.baseHref, + entrypoints: generateEntryPoints(buildOptions), + deployUrl: buildOptions.deployUrl, + sri: buildOptions.subresourceIntegrity, + })); + } + if (buildOptions.subresourceIntegrity) { extraPlugins.push(new SubresourceIntegrityPlugin({ hashFuncNames: ['sha384'] @@ -102,16 +113,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions) { } } }, - plugins: extraPlugins.concat([ - new IndexHtmlWebpackPlugin({ - input: path.resolve(root, buildOptions.index), - output: path.basename(buildOptions.index), - baseHref: buildOptions.baseHref, - entrypoints: generateEntryPoints(buildOptions), - deployUrl: buildOptions.deployUrl, - sri: buildOptions.subresourceIntegrity, - }), - ]), + plugins: extraPlugins, node: false, }; }