fix(@angular/build): re-analyze exports on package.json change in library builder - #34218
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for dynamically re-analyzing entry points and recompiling them when package.json is modified during watch mode in the Angular library builder. It refactors entry point normalization into pipeline/entry-points.ts and adds helper functions to track and update watched entry points, accompanied by comprehensive unit and behavior tests. The review feedback highlights two key improvement opportunities: throwing an error if the name field is missing or removed from package.json during watch mode to avoid inconsistent states, and typing options.entryPoints as a mutable Map instead of ReadonlyMap in updateWatchedEntryPoints to ensure type safety upon reassignment.
…rary builder When `package.json` changes in watch mode, the `exports` field is now re-analyzed to detect any added, removed, or modified entry points. New entry points are registered into watched files and trigger a re-compilation, while removed entry points are pruned from cached bundle results.
6878a37 to
c52432b
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When running the library builder in watch mode and updating
package.json, newly added, removed, or changed entry points inexportsare not detected or re-analyzed.Issue Number: N/A
What is the new behavior?
When
package.jsonchanges in watch mode, theexportsfield is now re-analyzed to detect any added, removed, or modified entry points. New entry points are registered into watched files and trigger a re-compilation, while removed entry points are pruned from cached bundle results.Also refactored entry point normalization logic into
pipeline/entry-points.tsand added unit test coverage forgetEntryPointBundleName,normalizeEntryPoints,haveEntryPointsChanged, andupdateWatchedEntryPoints.Does this PR introduce a breaking change?
Other information