Repository navigation
fix(@angular/build): improve library watch mode state invalidation and lazy asset matchers - #34426
Open
alan-agius4 wants to merge 7 commits into
Open
alan-agius4 wants to merge 7 commits into
alan-agius4 wants to merge 7 commits into
Conversation
…d lazy asset matchers - Log uncaught errors in `executeBuild` and `loadPackageJson` in `builder.ts`, and track `hasPackageJsonError` in the watch loop so `loadPackageJson` is retried on subsequent watch events until `package.json` is fixed. - Watch `styleIncludePaths` in `setupWatcher` and only call `resetSassWorkerPoolCaches()` when stylesheet files are added or removed or `package.json` changes, rather than on every in-place stylesheet edit. - Lazily initialize `#assetMatchers` in `BuilderState.collectAssets` only on incremental watch builds rather than unconditionally in the constructor. - Reset `compilationInstance` and clear cached `esmFiles`/`dtsFiles` and `previousBundleResults` when `compilationMode` changes, and mark entry point DTS files dirty when `declarationMap` changes. - Prune non-asset paths from `#pendingAssetFiles` in `BuilderState.collectAssets` after `collectAssetsToEmit` completes.
…tion and lazy asset matchers
…tion and lazy asset matchers
…tion and lazy asset matchers
…tion and lazy asset matchers
alan-agius4
marked this pull request as ready for review
October 20, 2026 09:41
There was a problem hiding this comment.
Code Review
This pull request introduces incremental build improvements for Angular libraries, including lazy asset matcher creation, pruning non-asset paths, and handling dynamic changes to compilationMode and declarationMap in watch mode. It also adds support for retrying package.json reloads after failures and watching style include paths. The review feedback suggests wrapping compilationInstance.close() in a try-catch block to avoid masking compilation errors during cleanup, and using a nullish coalescing operator when spreading styleIncludePaths to prevent potential runtime errors.
…tion and lazy asset matchers
…tion and lazy asset matchers
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.
Summary
hasPackageJsonErrorin the watch loop inbuilder.tssoloadPackageJsonis retried on subsequent watch events even ifpackage.jsonis not in the newchangedFilesuntilpackage.jsonis fixed.styleIncludePathsinsetupWatcherand also reset Sass worker pool caches (resetSassWorkerPoolCaches()) when.cssfiles change in addition to.scss/.sass.#assetMatchersinBuilderState.collectAssetsonly when needed in incremental watch mode rather than unconditionally innew BuilderState().Benchmark
main