@@ -35,14 +35,14 @@ export class NgCliWebpackConfig {
3535 deployUrl ?: string ,
3636 outputHashing ?: string
3737 ) {
38- const config : CliConfig = CliConfig . fromProject ( ) ;
39- const appConfig = config . config . apps [ 0 ] ;
38+ const appConfig = CliConfig . fromProject ( ) . config . apps [ 0 ] ;
39+ const projectRoot = this . ngCliProject . root ;
4040
4141 appConfig . outDir = outputDir || appConfig . outDir ;
4242 appConfig . deployUrl = deployUrl || appConfig . deployUrl ;
4343
4444 let baseConfig = getWebpackCommonConfig (
45- this . ngCliProject . root ,
45+ projectRoot ,
4646 environment ,
4747 appConfig ,
4848 baseHref ,
@@ -52,28 +52,28 @@ export class NgCliWebpackConfig {
5252 progress ,
5353 outputHashing
5454 ) ;
55- let targetConfigPartial = this . getTargetConfig (
56- this . ngCliProject . root , appConfig , sourcemap , verbose
57- ) ;
58- const typescriptConfigPartial = isAoT
59- ? getWebpackAotConfigPartial ( this . ngCliProject . root , appConfig , i18nFile , i18nFormat , locale )
60- : getWebpackNonAotConfigPartial ( this . ngCliProject . root , appConfig ) ;
55+ let targetConfigPartial = this . getTargetConfig ( projectRoot , appConfig , sourcemap , verbose ) ;
6156
6257 if ( appConfig . mobile ) {
63- let mobileConfigPartial = getWebpackMobileConfigPartial ( this . ngCliProject . root , appConfig ) ;
64- let mobileProdConfigPartial = getWebpackMobileProdConfigPartial ( this . ngCliProject . root ,
65- appConfig ) ;
58+ let mobileConfigPartial = getWebpackMobileConfigPartial ( projectRoot , appConfig ) ;
59+ let mobileProdConfigPartial = getWebpackMobileProdConfigPartial ( projectRoot , appConfig ) ;
6660 baseConfig = webpackMerge ( baseConfig , mobileConfigPartial ) ;
6761 if ( this . target == 'production' ) {
6862 targetConfigPartial = webpackMerge ( targetConfigPartial , mobileProdConfigPartial ) ;
6963 }
7064 }
7165
72- this . config = webpackMerge (
73- baseConfig ,
74- targetConfigPartial ,
75- typescriptConfigPartial
76- ) ;
66+ let config = webpackMerge ( baseConfig , targetConfigPartial ) ;
67+
68+ if ( appConfig . main ) {
69+ const typescriptConfigPartial = isAoT
70+ ? getWebpackAotConfigPartial ( projectRoot , appConfig , i18nFile , i18nFormat , locale )
71+ : getWebpackNonAotConfigPartial ( projectRoot , appConfig ) ;
72+
73+ config = webpackMerge ( config , typescriptConfigPartial ) ;
74+ }
75+
76+ this . config = config ;
7777 }
7878
7979 getTargetConfig ( projectRoot : string , appConfig : any , sourcemap : boolean , verbose : boolean ) : any {
0 commit comments