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: change the order of exports field keys to fix type resolution #323

Closed
wants to merge 1 commit into from

Conversation

haoqunjiang
Copy link

@haoqunjiang haoqunjiang commented Nov 6, 2023

As both ./min and . points to the same type definition file, sometimes TypeScript will resolve the type definition entry to the ./min key as it appears first.

microsoft/TypeScript#56290 (comment)

While this is not incorrect behavior, it breaks compatibility with older build environments that do not support the exports field. (e.g. TypeScript with moduleResolution: "node" instead of bundler or node16), as the ./min entry is only available through the exports field.

Some Vue.js users are experiencing this issue:
vuejs/core#9521

As both `./min` and `.` points to the same type definition file,
sometimes TypeScript will resolve the type definition file to the
`./min` key as it appears first.

microsoft/TypeScript#56290 (comment)

While this is not incorrect behavior, it breaks compatibility with older
build environments that do not support the `exports` field. (e.g.
TypeScript with `moduleResolution: "node"` instead of `bundler` or
`node16`), as the `./min` entry is only available through the `exports`
field.

Some Vue.js users are experiencing this issue:
vuejs/core#9521
@isaacs
Copy link
Owner

isaacs commented Nov 10, 2023

As it happens, I'm in the middle of refactoring the artisanal hand-crafted build scripts to use tshy anyway, will do this as part of that.

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

Successfully merging this pull request may close these issues.

3 participants