@@ -35,14 +35,14 @@ export class NgCliWebpackConfig {
35
35
deployUrl ?: string ,
36
36
outputHashing ?: string
37
37
) {
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 ;
40
40
41
41
appConfig . outDir = outputDir || appConfig . outDir ;
42
42
appConfig . deployUrl = deployUrl || appConfig . deployUrl ;
43
43
44
44
let baseConfig = getWebpackCommonConfig (
45
- this . ngCliProject . root ,
45
+ projectRoot ,
46
46
environment ,
47
47
appConfig ,
48
48
baseHref ,
@@ -52,28 +52,28 @@ export class NgCliWebpackConfig {
52
52
progress ,
53
53
outputHashing
54
54
) ;
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 ) ;
61
56
62
57
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 ) ;
66
60
baseConfig = webpackMerge ( baseConfig , mobileConfigPartial ) ;
67
61
if ( this . target == 'production' ) {
68
62
targetConfigPartial = webpackMerge ( targetConfigPartial , mobileProdConfigPartial ) ;
69
63
}
70
64
}
71
65
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 ;
77
77
}
78
78
79
79
getTargetConfig ( projectRoot : string , appConfig : any , sourcemap : boolean , verbose : boolean ) : any {
0 commit comments