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

build: add top level react-native field to package.json #98

Merged
merged 1 commit into from
Oct 26, 2023
Merged

build: add top level react-native field to package.json #98

merged 1 commit into from
Oct 26, 2023

Conversation

robertying
Copy link
Contributor

πŸ”— Linked issue

Should fix similar issues as #91

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

React Native seems to only respect the export defined as a root field inside package.json. See https://github.com/callstack/react-native-paper/blob/aebeabd8769988b17bb56b0f5673f252e1bda0d9/package.json#L7.

Tested on React Native 0.72.6 and Metro 0.76.8.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@robertying robertying changed the title feat: update react native export fix: update react native export Oct 26, 2023
@pi0 pi0 changed the title fix: update react native export build: add top level react-native field to package.json Oct 26, 2023
@pi0
Copy link
Member

pi0 commented Oct 26, 2023

Thanks for the PR ❀️

Regarding introducing this field, do you have any documentation references in metro/rn docs? It seems from this article that exports field support is coming.

Introducing a new field like this is no problem but we have many more package at least in unjs ecosystem that for react-native compatibility might need this and i want to make sure if a consistent change like this happens, it would be useful for short/longterm.

Maybe @huntie has some ideas? (for the context, we do have react-native export condition today)

@robertying
Copy link
Contributor Author

robertying commented Oct 26, 2023

@pi0 I tried to enable the metro option unstable_enablePackageExports but then axios can't be imported correctly somehow, which works well with the option disabled.

I think this change is more for backward compatibility until new metro changes are in place and widely adopted.

@pi0
Copy link
Member

pi0 commented Oct 26, 2023

Okay let's have it for sake of ecosystem adoption (i think for ofetch.unjs.io we also need it then)

@pi0 pi0 merged commit ea3bd1b into unjs:main Oct 26, 2023
1 check passed
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.

2 participants