Visitar URL original
perf(@angular/build): avoid invalidating Angular diagnostic cache on … · angular-robot/angular-cli@a428021 · GitHub
Skip to content

Commit a428021

Browse files
committed
perf(@angular/build): avoid invalidating Angular diagnostic cache on stylesheet change
Component stylesheets (.css, .scss, .sass, .less) do not impact TypeScript semantic diagnostics or Angular template diagnostics. When a stylesheet dependency changes during watch rebuilds, avoid deleting the component's cached Angular diagnostics or marking the component source file as affected for diagnostics re-collection. (cherry picked from commit 0a077ee)
1 parent cfaa2c1 commit a428021

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ export class AotCompilation extends TypeScriptCompilation {
216216
// Also invalidate Angular diagnostics for a source file if component resources are modified
217217
if (this.#state && hostOptions.modifiedFiles?.size) {
218218
for (const resourceDependency of resourceDependencies) {
219-
if (hostOptions.modifiedFiles.has(resourceDependency)) {
219+
if (
220+
hostOptions.modifiedFiles.has(resourceDependency) &&
221+
!/\.(?:css|scss|sass|less)$/i.test(resourceDependency)
222+
) {
220223
this.#state.diagnosticCache.delete(sourceFile);
221224
// Also mark as affected in case changed template affects diagnostics
222225
affectedFiles.add(sourceFile);

0 commit comments

Comments
 (0)