@@ -34,14 +34,14 @@ export class NgCliWebpackConfig {
34
34
progress = true ,
35
35
deployUrl ?: string
36
36
) {
37
- const config : CliConfig = CliConfig . fromProject ( ) ;
38
- const appConfig = config . config . apps [ 0 ] ;
37
+ const appConfig = CliConfig . fromProject ( ) . config . apps [ 0 ] ;
38
+ const projectRoot = this . ngCliProject . root ;
39
39
40
40
appConfig . outDir = outputDir || appConfig . outDir ;
41
41
appConfig . deployUrl = deployUrl || appConfig . deployUrl ;
42
42
43
43
let baseConfig = getWebpackCommonConfig (
44
- this . ngCliProject . root ,
44
+ projectRoot ,
45
45
environment ,
46
46
appConfig ,
47
47
baseHref ,
@@ -50,28 +50,28 @@ export class NgCliWebpackConfig {
50
50
verbose ,
51
51
progress
52
52
) ;
53
- let targetConfigPartial = this . getTargetConfig (
54
- this . ngCliProject . root , appConfig , sourcemap , verbose
55
- ) ;
56
- const typescriptConfigPartial = isAoT
57
- ? getWebpackAotConfigPartial ( this . ngCliProject . root , appConfig , i18nFile , i18nFormat , locale )
58
- : getWebpackNonAotConfigPartial ( this . ngCliProject . root , appConfig ) ;
53
+ let targetConfigPartial = this . getTargetConfig ( projectRoot , appConfig , sourcemap , verbose ) ;
59
54
60
55
if ( appConfig . mobile ) {
61
- let mobileConfigPartial = getWebpackMobileConfigPartial ( this . ngCliProject . root , appConfig ) ;
62
- let mobileProdConfigPartial = getWebpackMobileProdConfigPartial ( this . ngCliProject . root ,
63
- appConfig ) ;
56
+ let mobileConfigPartial = getWebpackMobileConfigPartial ( projectRoot , appConfig ) ;
57
+ let mobileProdConfigPartial = getWebpackMobileProdConfigPartial ( projectRoot , appConfig ) ;
64
58
baseConfig = webpackMerge ( baseConfig , mobileConfigPartial ) ;
65
59
if ( this . target == 'production' ) {
66
60
targetConfigPartial = webpackMerge ( targetConfigPartial , mobileProdConfigPartial ) ;
67
61
}
68
62
}
69
63
70
- this . config = webpackMerge (
71
- baseConfig ,
72
- targetConfigPartial ,
73
- typescriptConfigPartial
74
- ) ;
64
+ let config = webpackMerge ( baseConfig , targetConfigPartial ) ;
65
+
66
+ if ( appConfig . main ) {
67
+ const typescriptConfigPartial = isAoT
68
+ ? getWebpackAotConfigPartial ( projectRoot , appConfig , i18nFile , i18nFormat , locale )
69
+ : getWebpackNonAotConfigPartial ( projectRoot , appConfig ) ;
70
+
71
+ config = webpackMerge ( config , typescriptConfigPartial ) ;
72
+ }
73
+
74
+ this . config = config ;
75
75
}
76
76
77
77
getTargetConfig ( projectRoot : string , appConfig : any , sourcemap : boolean , verbose : boolean ) : any {
0 commit comments