@@ -64,6 +64,7 @@ import {
64
64
normalizeOptimization ,
65
65
normalizeSourceMaps ,
66
66
} from '../utils' ;
67
+ import { I18nOptions , createI18nOptions } from '../utils/i18n-options' ;
67
68
import { manglingDisabled } from '../utils/mangle-options' ;
68
69
import {
69
70
CacheKey ,
@@ -167,13 +168,23 @@ async function initialize(
167
168
context : BuilderContext ,
168
169
host : virtualFs . Host < fs . Stats > ,
169
170
webpackConfigurationTransform ?: ExecutionTransformer < webpack . Configuration > ,
170
- ) : Promise < { config : webpack . Configuration [ ] ; projectRoot : string ; projectSourceRoot ?: string } > {
171
+ ) : Promise < {
172
+ config : webpack . Configuration [ ] ;
173
+ projectRoot : string ;
174
+ projectSourceRoot ?: string ;
175
+ i18n : I18nOptions ;
176
+ } > {
171
177
const { config, projectRoot, projectSourceRoot } = await buildBrowserWebpackConfigFromContext (
172
178
options ,
173
179
context ,
174
180
host ,
175
181
) ;
176
182
183
+ // target is verified in the above call
184
+ // tslint:disable-next-line: no-non-null-assertion
185
+ const metadata = await context . getProjectMetadata ( context . target ! ) ;
186
+ const i18n = createI18nOptions ( metadata ) ;
187
+
177
188
let transformedConfig ;
178
189
if ( webpackConfigurationTransform ) {
179
190
transformedConfig = [ ] ;
@@ -190,7 +201,7 @@ async function initialize(
190
201
) . toPromise ( ) ;
191
202
}
192
203
193
- return { config : transformedConfig || config , projectRoot, projectSourceRoot } ;
204
+ return { config : transformedConfig || config , projectRoot, projectSourceRoot, i18n } ;
194
205
}
195
206
196
207
// tslint:disable-next-line: no-big-function
@@ -211,7 +222,7 @@ export function buildWebpackBrowser(
211
222
212
223
return from ( initialize ( options , context , host , transforms . webpackConfiguration ) ) . pipe (
213
224
// tslint:disable-next-line: no-big-function
214
- switchMap ( ( { config : configs , projectRoot } ) => {
225
+ switchMap ( ( { config : configs , projectRoot, i18n } ) => {
215
226
const tsConfig = readTsconfig ( options . tsConfig , context . workspaceRoot ) ;
216
227
const target = tsConfig . options . target || ScriptTarget . ES5 ;
217
228
const buildBrowserFeatures = new BuildBrowserFeatures ( projectRoot , target ) ;
@@ -591,7 +602,7 @@ export function buildWebpackBrowser(
591
602
? workerFile
592
603
: require . resolve ( '../utils/process-bundle-bootstrap' ) ,
593
604
'process' ,
594
- { cachePath : cacheDownlevelPath } ,
605
+ { cachePath : cacheDownlevelPath , i18n } ,
595
606
) ;
596
607
597
608
try {
0 commit comments