-
Notifications
You must be signed in to change notification settings - Fork 946
fix: add package exports field for correct interop and bundler support #1653
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
Conversation
|
@silviuaavram Review please |
|
@martinnaj can you take another look over the comments please? Also, is there any change required for those |
|
@silviuaavram Which comments? This shouldn't break anything, just provide better ESM support, there may be a need for react-native users to import using the alias, however that will be based on the transpiler. |
|
@silviuaavram Please re-review |
|
@silviuaavram bump |
|
Looks good @martinnaj ! Thank you for the changes, they should be really helpful! Could we also add a
|
|
@silviuaavram Done, please merge asap |
|
🎉 This PR is included in version 9.0.10 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Add an
"exports"field topackage.jsonto provide explicit module resolution paths for both ESM and CommonJS consumers. Also add an explicit"./react-native"export to support React Native's Metro bundler while preserving the existing"react-native"field.Why:
Currently, importing Downshift in some environments (Node.js native ESM, bundlers) causes issues where users must access
.defaultdue to CommonJS interop. Adding"exports"clarifies the entry points and avoids this common pitfall.Furthermore, React Native support requires the
"react-native"field, which is preserved, but adding the"./react-native"export path improves compatibility with native module resolution.How:
"exports"object topackage.jsonwith explicit"import"and"require"paths for"."."./react-native"export path pointing to the native CommonJS build."main","module", and"react-native"fields for backward compatibility.Checklist: