@@ -51,7 +51,7 @@ import {
5151 normalizeSourceMaps ,
5252} from '../utils' ;
5353import { copyAssets } from '../utils/copy-assets' ;
54- import { I18nOptions , createI18nOptions } from '../utils/i18n-options' ;
54+ import { I18nOptions , createI18nOptions , mergeDeprecatedI18nOptions } from '../utils/i18n-options' ;
5555import { createTranslationLoader } from '../utils/load-translations' ;
5656import {
5757 InlineOptions ,
@@ -163,9 +163,21 @@ async function initialize(
163163 throw new Error ( 'The builder requires a target.' ) ;
164164 }
165165
166+ const tsConfig = readTsconfig ( options . tsConfig , context . workspaceRoot ) ;
167+ const usingIvy = tsConfig . options . enableIvy !== false ;
166168 const metadata = await context . getProjectMetadata ( context . target ) ;
167169 const i18n = createI18nOptions ( metadata , options . localize ) ;
168170
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+
169181 if ( i18n . inlineLocales . size > 0 ) {
170182 // Load locales
171183 const loader = await createTranslationLoader ( ) ;
@@ -283,8 +295,14 @@ export function buildWebpackBrowser(
283295
284296 return { success } ;
285297 } 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+ }
288306 }
289307
290308 let noModuleFiles : EmittedFiles [ ] | undefined ;
@@ -475,13 +493,6 @@ export function buildWebpackBrowser(
475493
476494 let hasErrors = false ;
477495 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-
485496 for await ( const result of executor . inlineAll ( inlineActions ) ) {
486497 if ( options . verbose ) {
487498 context . logger . info (
@@ -499,9 +510,6 @@ export function buildWebpackBrowser(
499510 }
500511
501512 // Copy any non-processed files into the output locations
502- const outputPaths = [ ...i18n . inlineLocales ] . map ( l =>
503- path . join ( baseOutputPath , l ) ,
504- ) ;
505513 await copyAssets (
506514 [
507515 {
@@ -510,7 +518,7 @@ export function buildWebpackBrowser(
510518 input : webpackStats . outputPath ! ,
511519 output : '' ,
512520 ignore : [ ...processedFiles ] . map ( f =>
513- // tslint:disable-next-line: no-non-null-assertion
521+ // tslint:disable-next-line: no-non-null-assertion
514522 path . relative ( webpackStats . outputPath ! , f ) ,
515523 ) ,
516524 } ,
@@ -546,9 +554,6 @@ export function buildWebpackBrowser(
546554
547555 // Copy assets
548556 if ( options . assets ) {
549- const outputPaths = i18n . shouldInline
550- ? [ ...i18n . inlineLocales ] . map ( l => path . join ( baseOutputPath , l ) )
551- : [ baseOutputPath ] ;
552557 try {
553558 await copyAssets (
554559 normalizeAssetPatterns (
@@ -640,10 +645,6 @@ export function buildWebpackBrowser(
640645 }
641646
642647 if ( options . index ) {
643- const outputPaths = i18n . shouldInline
644- ? [ ...i18n . inlineLocales ] . map ( l => path . join ( baseOutputPath , l ) )
645- : [ baseOutputPath ] ;
646-
647648 for ( const outputPath of outputPaths ) {
648649 try {
649650 await generateIndex (
0 commit comments