From c16527cbe5ef7d99f74864466cff1ba7eefd5a62 Mon Sep 17 00:00:00 2001 From: hollannikas Date: Tue, 18 Oct 2016 22:43:06 +0300 Subject: [PATCH] feat(build) use appConfig.index to set output index file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass appConfig.index to the HtmlWebpackPlugin’s filename property. Closes #2241 --- .../angular-cli/models/webpack-build-common.ts | 1 + tests/e2e/tests/build/filename.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/e2e/tests/build/filename.ts diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index aae14af6663c..878f12f3c52c 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -105,6 +105,7 @@ export function getWebpackCommonConfig( plugins: [ new HtmlWebpackPlugin({ template: path.resolve(appRoot, appConfig.index), + filename: path.resolve(appConfig.outDir, appConfig.index), chunksSortMode: 'dependency' }), new BaseHrefWebpackPlugin({ diff --git a/tests/e2e/tests/build/filename.ts b/tests/e2e/tests/build/filename.ts new file mode 100644 index 000000000000..9d5ad1721733 --- /dev/null +++ b/tests/e2e/tests/build/filename.ts @@ -0,0 +1,15 @@ +import {ng} from '../../utils/process'; +import {expectFileToExist} from '../../utils/fs'; +import {updateJsonFile} from '../../utils/project'; + + +export default function() { + return Promise.resolve() + .then(() => updateJsonFile('angular-cli.json', configJson => { + const app = configJson['apps'][0]; + app['outDir'] = 'config-build-output'; + app['index'] = 'config-index.html'; + })) + .then(() => ng('build')) + .then(() => expectFileToExist('./config-build-output/config-index.html')); +}