From b972f8865535c672579ffa7b8945a783a02c7f70 Mon Sep 17 00:00:00 2001 From: Chang Liu <3dslayer@gmail.com> Date: Thu, 19 Jan 2017 01:01:07 +1100 Subject: [PATCH] refactor (build): refactor the logic to set publicPath --- packages/angular-cli/models/webpack-build-common.ts | 3 ++- packages/angular-cli/models/webpack-config.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index 53d21fd73736..c512a4e1553e 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -35,6 +35,7 @@ export function getWebpackCommonConfig( progress: boolean, outputHashing: string, extractCss: boolean, + deployUrl: string ) { const appRoot = path.resolve(projectRoot, appConfig.root); @@ -149,7 +150,7 @@ export function getWebpackCommonConfig( entry: entryPoints, output: { path: path.resolve(projectRoot, appConfig.outDir), - publicPath: appConfig.deployUrl, + publicPath: deployUrl, filename: `[name]${hashFormat.chunk}.bundle.js`, sourceMapFilename: `[name]${hashFormat.chunk}.bundle.map`, chunkFilename: `[id]${hashFormat.chunk}.chunk.js` diff --git a/packages/angular-cli/models/webpack-config.ts b/packages/angular-cli/models/webpack-config.ts index 1c286c61126a..661f090c7d16 100644 --- a/packages/angular-cli/models/webpack-config.ts +++ b/packages/angular-cli/models/webpack-config.ts @@ -40,7 +40,6 @@ export class NgCliWebpackConfig { const projectRoot = this.ngCliProject.root; appConfig.outDir = outputDir || appConfig.outDir; - appConfig.deployUrl = deployUrl || appConfig.deployUrl; let baseConfig = getWebpackCommonConfig( projectRoot, @@ -53,6 +52,7 @@ export class NgCliWebpackConfig { progress, outputHashing, extractCss, + deployUrl ); let targetConfigPartial = this.getTargetConfig(projectRoot, appConfig, sourcemap, verbose);