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(dts): ensure chunks conform to bundle format #1034

Merged
merged 3 commits into from
Nov 19, 2023

Conversation

ckohen
Copy link
Contributor

@ckohen ckohen commented Nov 16, 2023

For runs with multiple entrypoints, there will sometimes be chunks generated. Currently, the chunks generated always output .d.ts regardless of format, since that is rollup-plugin-dts's default. The prior PR fixed this for the main bundle output, but not these chunks.

In a lot of cases, this would be a non issue. However, in certain cases, a type is determined to be "internal" even though typescript can see through to the expected type. Because this file ends in .ts, it finds the nearest package.json to determine the module type (lets say cjs for this example). If this "internal" type is imported from another package with dual exports (say for something that's a peer dep), and then imported in application code that is another type (esm for this example), the same import is found in the two separate exports of said subpackage and may not be assignable to the same type. This is particularly noticeable with classes that have true private properties,

Copy link

codesandbox bot commented Nov 16, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Nov 16, 2023

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

Name Status Preview Comments Updated (UTC)
tsup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2023 1:29am

@ocavue
Copy link
Collaborator

ocavue commented Nov 17, 2023

Thanks. Could you add a test case? You can check this one as an example.

@ocavue ocavue merged commit f83baf8 into egoist:dev Nov 19, 2023
9 checks passed
@ckohen ckohen deleted the fix/dts-chunks branch November 19, 2023 21:46
Copy link
Contributor

🎉 This PR is included in version 8.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants