Skip to content

Commit 0e46942

Browse files
rahulbhooteshwarclydin
authored andcommitted
feat(@ngtools/webpack): prevent build failure in case of custom locale
1 parent 71f3822 commit 0e46942

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/@ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export class AngularCompilerPlugin {
336336
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
337337
}
338338

339-
// Use an identity function as all our paths are absolute already.
339+
// Use an identity function as all our paths are absolute already.
340340
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);
341341

342342
if (this._JitMode) {
@@ -649,7 +649,7 @@ export class AngularCompilerPlugin {
649649
// when the issuer is a `.ts` or `.ngfactory.js` file.
650650
nmf.hooks.beforeResolve.tapAsync('angular-compiler', (request: any, callback: any) => {
651651
if (this.done && (request.request.endsWith('.ts')
652-
|| (request.context.issuer && /\.ts|ngfactory\.js$/.test(request.context.issuer)))) {
652+
|| (request.context.issuer && /\.ts|ngfactory\.js$/.test(request.context.issuer)))) {
653653
this.done.then(() => callback(null, request), () => callback(null, request));
654654
} else {
655655
callback(null, request);
@@ -920,7 +920,7 @@ export class AngularCompilerPlugin {
920920
.map((resourcePath) => path.resolve(path.dirname(resolvedFileName), resourcePath));
921921

922922
// These paths are meant to be used by the loader so we must denormalize them.
923-
const uniqueDependencies = new Set([
923+
const uniqueDependencies = new Set([
924924
...esImports,
925925
...resourceImports,
926926
...this.getResourceDependencies(resolvedFileName)
@@ -1065,9 +1065,9 @@ export class AngularCompilerPlugin {
10651065
if (locales.indexOf(parentLocale) !== -1) {
10661066
locale = parentLocale;
10671067
} else {
1068-
throw new Error(
1069-
`Unable to load the locale data file "@angular/common/locales/${locale}", ` +
1070-
`please check that "${locale}" is a valid locale id.`);
1068+
console.log(`Unable to load the locale data file "@angular/common/locales/${locale}", ` +
1069+
`please check that "${locale}" is a valid locale id. Proceeding with default locale data registration i.e. 'en'. If needed, localeData can be registered against custom locale in application module.`);
1070+
locale = 'en';
10711071
}
10721072
}
10731073
}

0 commit comments

Comments
 (0)