Skip to content

fix(@angular/build): normalize package.json exports conditions and preserve sideEffects: true - #34421

Closed
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/library-package-manifests-exports
Closed

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/library-package-manifests-exports

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Summary

  • Treat root conditional exports objects (where keys do not start with .) as conditions for the primary entry point (.) instead of spreading condition keys at the top level of exportsMap.
  • Normalize subpath keys in userExports (e.g., testing and ./testing/ -> ./testing) so unnormalized keys do not remain in the emitted package.json#exports alongside normalized entry points.
  • Omit conditional export entries whose string values point to unbuilt .ts or .mts source files (/(?<!\.d)\.m?ts$/) so they do not take precedence over default in the built package.
  • Ensure . and ./package.json appear first in the emitted exports map.
  • Add unit tests covering root conditional exports, unnormalized subpath keys, .ts/.mts condition stripping, export key ordering, and sideEffects: true.

…eserve sideEffects: true

Normalize user-defined `exports` in `generatePackageManifests` so that:
- Root conditional export objects (whose keys do not start with `.`) are treated as conditions for the primary entry point (`'.'`) rather than spread as top-level keys alongside `'.'`.
- Subpath export keys are normalized to canonical relative subpaths (e.g., `'testing'` and `'./testing/'` -> `'./testing'`) so unnormalized keys do not remain pointing to source files.
- Conditional export entries pointing to unbuilt TypeScript source files (`.ts` or `.mts`) are omitted so they do not shadow `default` in the emitted `package.json`.
- `'.'` and `'./package.json'` are consistently placed first in the emitted `exports` map.
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant