From 02e201ab1a0bdcf0e4a65a7c378577f6f6442810 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Mon, 6 Aug 2018 11:28:36 -0700 Subject: [PATCH] fix: add mappings for ngfactory & ngsummary files to their module names in aot summary resolver (#25335) PR Close #25335 --- packages/compiler/src/aot/summary_resolver.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/compiler/src/aot/summary_resolver.ts b/packages/compiler/src/aot/summary_resolver.ts index 0f2c1f855e..28bf5fac66 100644 --- a/packages/compiler/src/aot/summary_resolver.ts +++ b/packages/compiler/src/aot/summary_resolver.ts @@ -120,6 +120,16 @@ export class AotSummaryResolver implements SummaryResolver { summaries.forEach((summary) => this.summaryCache.set(summary.symbol, summary)); if (moduleName) { this.knownFileNameToModuleNames.set(filePath, moduleName); + if (filePath.endsWith('.d.ts')) { + // Also add entries to map the ngfactory & ngsummary files to their module names. + // This is necessary to resolve ngfactory & ngsummary files to their AMD module + // names when building angular with Bazel from source downstream. + // See https://github.com/bazelbuild/rules_typescript/pull/223 for context. + this.knownFileNameToModuleNames.set( + filePath.replace(/\.d\.ts$/, '.ngfactory.d.ts'), moduleName + '.ngfactory'); + this.knownFileNameToModuleNames.set( + filePath.replace(/\.d\.ts$/, '.ngsummary.d.ts'), moduleName + '.ngsummary'); + } } importAs.forEach((importAs) => { this.importAs.set(importAs.symbol, importAs.importAs); }); }