fix(angular-rspack): keep incremental rebuild state warm when skipTypeChecking is enabled - #36972
Merged
leosvelperez merged 2 commits intoSep 10, 2026
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
Contributor
|
View your CI Pipeline Execution ↗ for commit b1cbbff
☁️ Nx Cloud last updated this comment at |
leosvelperez
requested changes
Sep 10, 2026
leosvelperez
left a comment
Member
There was a problem hiding this comment.
Thanks! Change looks good, but let's simplify the added comments.
…eChecking is enabled Problem: `skipTypeChecking: true` strips the Semantic diagnostic mode from `AngularCompilation#diagnoseFiles()`. Semantic mode is the only path that reaches `NgCompiler#ensureAnalyzed()`, which is the only place the Angular compiler's incremental state advances from `Fresh` to `Analyzed`. Without that transition, `IncrementalCompilation#safeToSkipEmit()` always returns false, so every incremental rebuild re-emits the entire program instead of only the changed files - regardless of how small the edit is. On larger apps this turns single-file rebuilds into 20s+ full re-emits. Solution: `#createDiagnosticsPromise()` now always fires a second, silent `diagnoseFiles(DiagnosticModes.Semantic)` call whenever `skipTypeChecking` is true, purely for its incremental-state side effect. Its result (and any errors) are fully discarded and can never surface or fail the build - the surfaced diagnostics (`Option`/`Syntactic`) are unchanged from before. Both calls run concurrently via `Promise.all`, since they're verified to touch disjoint internal state. Closes nrwl#36970
…skipTypeChecking is enabled
skrtheboss
force-pushed
the
fix/angular-rspack-skip-type-checking-incremental-rebuild
branch
from
September 10, 2026 11:15
8c801d6 to
b1cbbff
Compare
Contributor
Author
|
@leosvelperez Thank you for the review. I have applied your suggestions, let me know if there is anything else I should adjust 👍 |
skrtheboss
deleted the
fix/angular-rspack-skip-type-checking-incremental-rebuild
branch
September 10, 2026 12:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
With
skipTypeChecking: trueset on@nx/angular-rspack'sAngularRspackPlugin, every incremental rebuild re-emits the entire program instead of only the changed file(s), no matter how small the edit is. On a real-world app (~6000 source files) this makes single-file rebuilds take 20-55 seconds instead of the expected 1-3 seconds.This happens because
skipTypeChecking: truestrips theSemanticdiagnostic mode from what's passed toAngularCompilation#diagnoseFiles(). Semantic mode is the only path that reachesNgCompiler#ensureAnalyzed()→recordSuccessfulAnalysis(), which is the only place the compiler's incremental state advances fromFreshtoAnalyzed. Without that transition,IncrementalCompilation#safeToSkipEmit()always returnsfalse, forcing a full re-emit on every rebuild.See #36970 for the full root-cause trace with source references.
Expected Behavior
skipTypeChecking: trueshould only suppress surfacing Semantic (type-checking) diagnostics - it should not disable the Angular compiler's incremental-emit optimization. Incremental rebuilds should re-emit only the files actually affected by a change, same as whenskipTypeCheckingisfalse.#createDiagnosticsPromise()now always fires a second, silentdiagnoseFiles(DiagnosticModes.Semantic)call wheneverskipTypeCheckingistrue, purely for its incremental-state side effect. Its result is fully discarded and can never surface or fail the build - the diagnostics actually surfaced to users (Option/Syntactic) are unchanged. Both calls run concurrently viaPromise.all, verified safe since they touch disjoint internal state (the surfaced call never requestsSemantic, so it never touches thediagnosticCache/getDiagnosticsForFilepath the silent call exercises).Validated against a real ~6000-file app: cold builds are unaffected (as expected), and every subsequent incremental rebuild dropped from 20-55s to 2-4s, with the correct "affected files" count reported.
Related Issue(s)
Fixes #36970