@@ -111,7 +111,7 @@ export class AngularCompilerPlugin {
111111 // Webpack plugin.
112112 private _firstRun = true ;
113113 private _donePromise : Promise < void > | null ;
114- private _normalizedLocale : string ;
114+ private _normalizedLocale : string | null ;
115115 private _warnings : ( string | Error ) [ ] = [ ] ;
116116 private _errors : ( string | Error ) [ ] = [ ] ;
117117
@@ -1038,7 +1038,7 @@ export class AngularCompilerPlugin {
10381038 return { program, emitResult, diagnostics : allDiagnostics } ;
10391039 }
10401040
1041- private _validateLocale ( locale : string ) {
1041+ private _validateLocale ( locale : string ) : string | null {
10421042 // Get the path of the common module.
10431043 const commonPath = path . dirname ( require . resolve ( '@angular/common/package.json' ) ) ;
10441044 // Check if the locale file exists
@@ -1065,11 +1065,12 @@ export class AngularCompilerPlugin {
10651065 if ( locales . indexOf ( parentLocale ) !== - 1 ) {
10661066 locale = parentLocale ;
10671067 } else {
1068- console . log ( `Unable to load the locale data file "@angular/common/locales/${ locale } ", ` +
1068+ this . _warnings . push ( `AngularCompilerPlugin: Unable to load the locale data file ` +
1069+ `"@angular/common/locales/${ locale } ", ` +
10691070 `please check that "${ locale } " is a valid locale id.
10701071 Proceeding with default locale data registration i.e. 'en'.
10711072 If needed, localeData can be registered against custom locale in application module.` ) ;
1072- locale = 'en' ;
1073+ return null ;
10731074 }
10741075 }
10751076 }
0 commit comments