Skip to content

fix(@angular/build): reject entry points that collide on bundle name - #34216

Closed
thekhegay wants to merge 2 commits into
angular:mainfrom
thekhegay:fix/library-entry-point-bundle-name-collision
Closed

thekhegay wants to merge 2 commits into
angular:mainfrom
thekhegay:fix/library-entry-point-bundle-name-collision

Conversation

@thekhegay

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

  • Bugfix

What is the current behavior?

Issue Number: #34128

getEntryPointBundleName flattens / to -, so ./zz/child and ./zz-child both produce lib-zz-child. The duplicate guard in normalizeEntryPoints keys on entryPoint.name, which still differs, so both survive. resolveEntryInputMap then writes input[bundleName] into a plain object and the second entry point silently overwrites the first, so Rolldown is handed one entry and cannot warn. The build exits 0, one entry point's code is missing, and both exports keys resolve to the surviving file.

What is the new behavior?

Normalization rejects the collision with an error naming both keys and the bundle name they share.

Two tests: a nested entry point beside a similarly named flat one still builds and emits both bundles, and the colliding pair fails. There was no test with a nested entry point before, so the / to - flattening itself was unpinned.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I could not run the builder tests locally, so CI is the first run of them.

A bundle name flattens '/' to '-', so './zz/child' and './zz-child' both
become 'lib-zz-child'. The bundler input map is keyed by that name, so the
second entry point silently overwrote the first: the build exited 0, one
entry point's code was missing, and both 'exports' keys resolved to the
surviving file.

Fixes angular#34128

@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 a check to prevent entry point subpaths from producing colliding bundle names when '/' is flattened to '-', throwing an error if a collision is detected, and adds corresponding unit tests. The review feedback suggests making this collision check case-insensitive to ensure cross-platform safety on case-insensitive filesystems (such as macOS and Windows).

Comment thread packages/angular/build/src/builders/library/options.ts Outdated
@alan-agius4

Copy link
Copy Markdown
Collaborator

Thanks for this, but this has been address via #34218

@alan-agius4 alan-agius4 closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants