@@ -25,6 +25,7 @@ function _createAotPlugin(
2525 options : any ,
2626 host : virtualFs . Host < Stats > ,
2727 useMain = true ,
28+ extract = false
2829) {
2930 const { root, buildOptions } = wco ;
3031 options . compilerOptions = options . compilerOptions || { } ;
@@ -37,6 +38,15 @@ function _createAotPlugin(
3738 ? path . resolve ( root , buildOptions . i18nFile )
3839 : undefined ;
3940
41+ const i18nFileAndFormat = extract
42+ ? {
43+ i18nOutFile : buildOptions . i18nFile ,
44+ i18nOutFormat : buildOptions . i18nFormat ,
45+ } : {
46+ i18nInFile : i18nInFile ,
47+ i18nInFormat : buildOptions . i18nFormat ,
48+ } ;
49+
4050 const additionalLazyModules : { [ module : string ] : string } = { } ;
4151 if ( buildOptions . lazyModules ) {
4252 for ( const lazyModule of buildOptions . lazyModules ) {
@@ -49,10 +59,7 @@ function _createAotPlugin(
4959
5060 const pluginOptions : AngularCompilerPluginOptions = {
5161 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 ,
5663 locale : buildOptions . i18nLocale ,
5764 platform : buildOptions . platform === 'server' ? PLATFORM . Server : PLATFORM . Browser ,
5865 missingTranslation : buildOptions . i18nMissingTranslation ,
@@ -75,7 +82,11 @@ export function getNonAotConfig(wco: WebpackConfigOptions, host: virtualFs.Host<
7582 } ;
7683}
7784
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+ ) {
7990 const { tsConfigPath, buildOptions } = wco ;
8091
8192 const loaders : any [ ] = [ webpackLoader ] ;
@@ -90,7 +101,7 @@ export function getAotConfig(wco: WebpackConfigOptions, host: virtualFs.Host<Sta
90101
91102 return {
92103 module : { rules : [ { test, use : loaders } ] } ,
93- plugins : [ _createAotPlugin ( wco , { tsConfigPath } , host ) ]
104+ plugins : [ _createAotPlugin ( wco , { tsConfigPath } , host , true , extract ) ]
94105 } ;
95106}
96107
0 commit comments