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')); +}