Skip to content

Commit

Permalink
feat(@ngtools/webpack): prevent build failure in case of custom locale
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulbhooteshwar authored and clydin committed Mar 3, 2018
1 parent 71f3822 commit 0e46942
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/@ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export class AngularCompilerPlugin {
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
}

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

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

// These paths are meant to be used by the loader so we must denormalize them.
const uniqueDependencies = new Set([
const uniqueDependencies = new Set([
...esImports,
...resourceImports,
...this.getResourceDependencies(resolvedFileName)
Expand Down Expand Up @@ -1065,9 +1065,9 @@ export class AngularCompilerPlugin {
if (locales.indexOf(parentLocale) !== -1) {
locale = parentLocale;
} else {
throw new Error(
`Unable to load the locale data file "@angular/common/locales/${locale}", ` +
`please check that "${locale}" is a valid locale id.`);
console.log(`Unable to load the locale data file "@angular/common/locales/${locale}", ` +
`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.`);
locale = 'en';
}
}
}
Expand Down

0 comments on commit 0e46942

Please sign in to comment.