Repository navigation
fix(@angular/build): improve library watch mode state invalidation and lazy asset matchers - #34426
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
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 PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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