Skip to content

fix(@angular/build): re-analyze exports on package.json change in library builder - #34218

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix/library-watch-exports
Oct 1, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix/library-watch-exports

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

When running the library builder in watch mode and updating package.json, newly added, removed, or changed entry points in exports are not detected or re-analyzed.

Issue Number: N/A

What is the new behavior?

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.

Also refactored entry point normalization logic into pipeline/entry-points.ts and added unit test coverage for getEntryPointBundleName, normalizeEntryPoints, haveEntryPointsChanged, and updateWatchedEntryPoints.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/angular/build/src/builders/library/builder.ts Outdated
Comment thread packages/angular/build/src/builders/library/pipeline/entry-points.ts Outdated
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Sep 30, 2026
@alan-agius4
alan-agius4 requested a review from clydin September 30, 2026 19:35
Comment thread packages/angular/build/src/builders/library/pipeline/entry-points.ts Outdated
Comment thread packages/angular/build/src/builders/library/pipeline/entry-points.ts Outdated
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 1, 2026
…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.
@alan-agius4 alan-agius4 linked an issue Oct 1, 2026 that may be closed by this pull request
1 task
@alan-agius4
alan-agius4 force-pushed the fix/library-watch-exports branch from 6878a37 to c52432b Compare October 1, 2026 07:15
@alan-agius4
alan-agius4 merged commit 76dd17d into angular:main Oct 1, 2026
39 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4
alan-agius4 deleted the fix/library-watch-exports branch October 1, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

library builder: entry points a/b and a-b are built into the same bundle

2 participants