@@ -33,6 +33,7 @@ import { ExecutionTransformer } from '../transforms';
3333import { BuildBrowserFeatures , normalizeOptimization } from '../utils' ;
3434import { findCachePath } from '../utils/cache-path' ;
3535import { I18nOptions } from '../utils/i18n-options' ;
36+ import { createI18nPlugins } from '../utils/process-bundle' ;
3637import { assertCompatibleAngularVersion } from '../utils/version' ;
3738import { getIndexInputFile , getIndexOutputFile } from '../utils/webpack-browser-config' ;
3839import { Schema } from './schema' ;
@@ -54,48 +55,6 @@ const devServerBuildOverriddenKeys: (keyof DevServerBuilderOptions)[] = [
5455 'deployUrl' ,
5556] ;
5657
57- async function createI18nPlugins (
58- locale : string ,
59- translation : unknown | undefined ,
60- missingTranslation ?: 'error' | 'warning' | 'ignore' ,
61- ) {
62- const plugins = [ ] ;
63- // tslint:disable-next-line: no-implicit-dependencies
64- const localizeDiag = await import ( '@angular/localize/src/tools/src/diagnostics' ) ;
65-
66- const diagnostics = new localizeDiag . Diagnostics ( ) ;
67-
68- const es2015 = await import (
69- // tslint:disable-next-line: trailing-comma no-implicit-dependencies
70- '@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin'
71- ) ;
72- plugins . push (
73- // tslint:disable-next-line: no-any
74- es2015 . makeEs2015TranslatePlugin ( diagnostics , ( translation || { } ) as any , {
75- missingTranslation : translation === undefined ? 'ignore' : missingTranslation ,
76- } ) ,
77- ) ;
78-
79- const es5 = await import (
80- // tslint:disable-next-line: trailing-comma no-implicit-dependencies
81- '@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin'
82- ) ;
83- plugins . push (
84- // tslint:disable-next-line: no-any
85- es5 . makeEs5TranslatePlugin ( diagnostics , ( translation || { } ) as any , {
86- missingTranslation : translation === undefined ? 'ignore' : missingTranslation ,
87- } ) ,
88- ) ;
89-
90- const inlineLocale = await import (
91- // tslint:disable-next-line: trailing-comma no-implicit-dependencies
92- '@angular/localize/src/tools/src/translate/source_files/locale_plugin'
93- ) ;
94- plugins . push ( inlineLocale . makeLocalePlugin ( locale ) ) ;
95-
96- return { diagnostics, plugins } ;
97- }
98-
9958export type DevServerBuilderOutput = DevServerBuildOutput & {
10059 baseUrl : string ;
10160} ;
@@ -328,7 +287,7 @@ async function setupLocalize(
328287 const { plugins, diagnostics } = await createI18nPlugins (
329288 locale ,
330289 localeDescription && localeDescription . translation ,
331- browserOptions . i18nMissingTranslation ,
290+ browserOptions . i18nMissingTranslation || 'ignore' ,
332291 ) ;
333292
334293 // Modify main entrypoint to include locale data
0 commit comments