@@ -51,7 +51,7 @@ import {
51
51
normalizeSourceMaps ,
52
52
} from '../utils' ;
53
53
import { copyAssets } from '../utils/copy-assets' ;
54
- import { I18nOptions , createI18nOptions } from '../utils/i18n-options' ;
54
+ import { I18nOptions , createI18nOptions , mergeDeprecatedI18nOptions } from '../utils/i18n-options' ;
55
55
import { createTranslationLoader } from '../utils/load-translations' ;
56
56
import {
57
57
InlineOptions ,
@@ -163,9 +163,21 @@ async function initialize(
163
163
throw new Error ( 'The builder requires a target.' ) ;
164
164
}
165
165
166
+ const tsConfig = readTsconfig ( options . tsConfig , context . workspaceRoot ) ;
167
+ const usingIvy = tsConfig . options . enableIvy !== false ;
166
168
const metadata = await context . getProjectMetadata ( context . target ) ;
167
169
const i18n = createI18nOptions ( metadata , options . localize ) ;
168
170
171
+ // Until 11.0, support deprecated i18n options when not using new localize option
172
+ // i18nFormat is automatically calculated
173
+ if ( options . localize === undefined && usingIvy ) {
174
+ mergeDeprecatedI18nOptions ( i18n , options . i18nLocale , options . i18nFile ) ;
175
+ } else if ( options . localize !== undefined && ! usingIvy ) {
176
+ options . localize = undefined ;
177
+
178
+ context . logger . warn ( `Option 'localize' is not supported with View Engine.` ) ;
179
+ }
180
+
169
181
if ( i18n . inlineLocales . size > 0 ) {
170
182
// Load locales
171
183
const loader = await createTranslationLoader ( ) ;
@@ -283,8 +295,14 @@ export function buildWebpackBrowser(
283
295
284
296
return { success } ;
285
297
} else if ( success ) {
286
- if ( ! fs . existsSync ( baseOutputPath ) ) {
287
- fs . mkdirSync ( baseOutputPath , { recursive : true } ) ;
298
+ const outputPaths =
299
+ i18n . shouldInline && ! i18n . flatOutput
300
+ ? [ ...i18n . inlineLocales ] . map ( l => path . join ( baseOutputPath , l ) )
301
+ : [ baseOutputPath ] ;
302
+ for ( const outputPath of outputPaths ) {
303
+ if ( ! fs . existsSync ( outputPath ) ) {
304
+ fs . mkdirSync ( outputPath , { recursive : true } ) ;
305
+ }
288
306
}
289
307
290
308
let noModuleFiles : EmittedFiles [ ] | undefined ;
@@ -475,13 +493,6 @@ export function buildWebpackBrowser(
475
493
476
494
let hasErrors = false ;
477
495
try {
478
- for ( const locale of i18n . inlineLocales ) {
479
- const localeOutputPath = path . join ( baseOutputPath , locale ) ;
480
- if ( ! fs . existsSync ( localeOutputPath ) ) {
481
- fs . mkdirSync ( localeOutputPath , { recursive : true } ) ;
482
- }
483
- }
484
-
485
496
for await ( const result of executor . inlineAll ( inlineActions ) ) {
486
497
if ( options . verbose ) {
487
498
context . logger . info (
@@ -499,9 +510,6 @@ export function buildWebpackBrowser(
499
510
}
500
511
501
512
// Copy any non-processed files into the output locations
502
- const outputPaths = [ ...i18n . inlineLocales ] . map ( l =>
503
- path . join ( baseOutputPath , l ) ,
504
- ) ;
505
513
await copyAssets (
506
514
[
507
515
{
@@ -510,7 +518,7 @@ export function buildWebpackBrowser(
510
518
input : webpackStats . outputPath ! ,
511
519
output : '' ,
512
520
ignore : [ ...processedFiles ] . map ( f =>
513
- // tslint:disable-next-line: no-non-null-assertion
521
+ // tslint:disable-next-line: no-non-null-assertion
514
522
path . relative ( webpackStats . outputPath ! , f ) ,
515
523
) ,
516
524
} ,
@@ -546,9 +554,6 @@ export function buildWebpackBrowser(
546
554
547
555
// Copy assets
548
556
if ( options . assets ) {
549
- const outputPaths = i18n . shouldInline
550
- ? [ ...i18n . inlineLocales ] . map ( l => path . join ( baseOutputPath , l ) )
551
- : [ baseOutputPath ] ;
552
557
try {
553
558
await copyAssets (
554
559
normalizeAssetPatterns (
@@ -640,10 +645,6 @@ export function buildWebpackBrowser(
640
645
}
641
646
642
647
if ( options . index ) {
643
- const outputPaths = i18n . shouldInline
644
- ? [ ...i18n . inlineLocales ] . map ( l => path . join ( baseOutputPath , l ) )
645
- : [ baseOutputPath ] ;
646
-
647
648
for ( const outputPath of outputPaths ) {
648
649
try {
649
650
await generateIndex (
0 commit comments