Skip to content

Commit 6c92f2b

Browse files
committed
fixup! perf(@angular/build): cache transformed configuration in TypeScript compilation
1 parent 4ba6907 commit 6c92f2b

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

‎packages/angular/build/src/tools/angular/compilation/typescript-compilation.ts‎

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,28 +135,30 @@ export abstract class TypeScriptCompilation extends AngularCompilation {
135135
const posixFile = toPosixPath(file);
136136
this.sourceFiles.delete(posixFile);
137137

138-
if (this.#extendedConfigCache.size) {
139-
let cacheKey: string | undefined;
140-
if (this.#extendedConfigCache.has(posixFile)) {
141-
cacheKey = posixFile;
142-
} else {
143-
// Check with lowercased key because TypeScript lowercases the keys
144-
// of the extended config cache on case-insensitive operating systems.
145-
const lowerCasedPosixFile = posixFile.toLowerCase();
146-
if (this.#extendedConfigCache.has(lowerCasedPosixFile)) {
147-
cacheKey = lowerCasedPosixFile;
148-
}
149-
}
138+
if (!this.#extendedConfigCache.size) {
139+
continue;
140+
}
150141

151-
if (!cacheKey) {
152-
continue;
142+
let cacheKey: string | undefined;
143+
if (this.#extendedConfigCache.has(posixFile)) {
144+
cacheKey = posixFile;
145+
} else {
146+
// Check with lowercased key because TypeScript lowercases the keys
147+
// of the extended config cache on case-insensitive operating systems.
148+
const lowerCasedPosixFile = posixFile.toLowerCase();
149+
if (this.#extendedConfigCache.has(lowerCasedPosixFile)) {
150+
cacheKey = lowerCasedPosixFile;
153151
}
152+
}
154153

155-
// If a tsconfig changes, we need to re-read the configuration.
156-
this.#cachedConfiguration = undefined;
157-
this.#cachedRootFiles = undefined;
158-
this.#extendedConfigCache.delete(cacheKey);
154+
if (!cacheKey) {
155+
continue;
159156
}
157+
158+
// If a tsconfig changes, we need to re-read the configuration.
159+
this.#cachedConfiguration = undefined;
160+
this.#cachedRootFiles = undefined;
161+
this.#extendedConfigCache.delete(cacheKey);
160162
}
161163
}
162164

0 commit comments

Comments
 (0)