@@ -25,6 +25,7 @@ function _createAotPlugin(
25
25
options : any ,
26
26
host : virtualFs . Host < Stats > ,
27
27
useMain = true ,
28
+ extract = false
28
29
) {
29
30
const { root, buildOptions } = wco ;
30
31
options . compilerOptions = options . compilerOptions || { } ;
@@ -37,6 +38,15 @@ function _createAotPlugin(
37
38
? path . resolve ( root , buildOptions . i18nFile )
38
39
: undefined ;
39
40
41
+ const i18nFileAndFormat = extract
42
+ ? {
43
+ i18nOutFile : buildOptions . i18nFile ,
44
+ i18nOutFormat : buildOptions . i18nFormat ,
45
+ } : {
46
+ i18nInFile : i18nInFile ,
47
+ i18nInFormat : buildOptions . i18nFormat ,
48
+ } ;
49
+
40
50
const additionalLazyModules : { [ module : string ] : string } = { } ;
41
51
if ( buildOptions . lazyModules ) {
42
52
for ( const lazyModule of buildOptions . lazyModules ) {
@@ -49,10 +59,7 @@ function _createAotPlugin(
49
59
50
60
const pluginOptions : AngularCompilerPluginOptions = {
51
61
mainPath : useMain ? path . join ( root , buildOptions . main ) : undefined ,
52
- i18nInFile : i18nInFile ,
53
- i18nInFormat : buildOptions . i18nFormat ,
54
- i18nOutFile : buildOptions . i18nOutFile ,
55
- i18nOutFormat : buildOptions . i18nOutFormat ,
62
+ ...i18nFileAndFormat ,
56
63
locale : buildOptions . i18nLocale ,
57
64
platform : buildOptions . platform === 'server' ? PLATFORM . Server : PLATFORM . Browser ,
58
65
missingTranslation : buildOptions . i18nMissingTranslation ,
@@ -75,7 +82,11 @@ export function getNonAotConfig(wco: WebpackConfigOptions, host: virtualFs.Host<
75
82
} ;
76
83
}
77
84
78
- export function getAotConfig ( wco : WebpackConfigOptions , host : virtualFs . Host < Stats > ) {
85
+ export function getAotConfig (
86
+ wco : WebpackConfigOptions ,
87
+ host : virtualFs . Host < Stats > ,
88
+ extract = false
89
+ ) {
79
90
const { tsConfigPath, buildOptions } = wco ;
80
91
81
92
const loaders : any [ ] = [ webpackLoader ] ;
@@ -90,7 +101,7 @@ export function getAotConfig(wco: WebpackConfigOptions, host: virtualFs.Host<Sta
90
101
91
102
return {
92
103
module : { rules : [ { test, use : loaders } ] } ,
93
- plugins : [ _createAotPlugin ( wco , { tsConfigPath } , host ) ]
104
+ plugins : [ _createAotPlugin ( wco , { tsConfigPath } , host , true , extract ) ]
94
105
} ;
95
106
}
96
107
0 commit comments