Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bundling): explicitly set types for exports entries in package.json #27152

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Jul 26, 2024

We currently rely on the TS behavior of matching d.ts files based on the .js file names. e.g. foo.js matches foo.d.ts. However, it isn't working for all tools so we should explicitly set it.

Most modern packages are still setting it even though it is not technically needed. e.g. Nuxt

Note: If both ESM and CJS are present, then prefer *.esm.d.ts files since the generated types are in ESM format.

Current Behavior

exports entries are missing types field

Expected Behavior

exports entries have types field set

Related Issue(s)

Fixes #18835

@jaysoo jaysoo requested a review from a team as a code owner July 26, 2024 14:45
@jaysoo jaysoo requested a review from leosvelperez July 26, 2024 14:45
Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jul 26, 2024 4:03pm

@jaysoo jaysoo merged commit 2d2c0b5 into master Jul 26, 2024
6 checks passed
@jaysoo jaysoo deleted the issue/18835 branch July 26, 2024 16:23
FrozenPandaz pushed a commit that referenced this pull request Jul 30, 2024
…on (#27152)

We currently rely on the TS behavior of matching `d.ts` files based on
the `.js` file names. e.g. `foo.js` matches `foo.d.ts`. However, it
isn't working for all tools so we should explicitly set it.

Most modern packages are still setting it even though it is not
technically needed. e.g.
[Nuxt](https://unpkg.com/browse/[email protected]/package.json)

Note: If both ESM and CJS are present, then prefer `*.esm.d.ts` files
since the generated types are in ESM format.

## Current Behavior
`exports` entries are missing `types` field

## Expected Behavior
`exports` entries have `types` field set

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18835

(cherry picked from commit 2d2c0b5)
Copy link

github-actions bot commented Aug 1, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package exports field does not include types
4 participants