From 2f5ddd9c96f7ea4ab0c1dd7fa67d62baa6bb0bbe Mon Sep 17 00:00:00 2001 From: JoostK Date: Sat, 7 Dec 2019 22:36:58 +0100 Subject: [PATCH] perf(ivy): cache export scopes extracted from declaration files (#34332) The export scope of NgModules from external compilations units, as present in .d.ts declarations, does not change during a compilation so can be easily shared. There was already a cache but the computed export scope was not actually stored there. This commit fixes that. PR Close #34332 --- packages/compiler-cli/src/ngtsc/scope/src/dependency.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/compiler-cli/src/ngtsc/scope/src/dependency.ts b/packages/compiler-cli/src/ngtsc/scope/src/dependency.ts index 2f405c5362..ab441af285 100644 --- a/packages/compiler-cli/src/ngtsc/scope/src/dependency.ts +++ b/packages/compiler-cli/src/ngtsc/scope/src/dependency.ts @@ -123,9 +123,11 @@ export class MetadataDtsModuleScopeResolver implements DtsModuleScopeResolver { throw new Error(`Exported value ${exportRef.debugName} was not a directive, pipe, or module`); } - return { + const exportScope: ExportScope = { exported: {directives, pipes}, }; + this.cache.set(clazz, exportScope); + return exportScope; } private maybeAlias(