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

exports in package.jsons need to be updated to work with Metro. #477

Open
samwightt opened this issue Sep 8, 2024 · 3 comments
Open

exports in package.jsons need to be updated to work with Metro. #477

samwightt opened this issue Sep 8, 2024 · 3 comments

Comments

@samwightt
Copy link
Contributor

Metro is the bundler for React Native. It has experimental support for the exports field in package.json, however I have had issues getting it to work with some of Evolu's packages. Things that need to change:

  • Any conditional exports that use browser need to be default instead. Node recommends using default instead of browser here: https://nodejs.org/docs/latest-v19.x/api/packages.html#conditional-exports
    • Other alternative is to add a default conditional export with the same value as browser.
  • Documentation needs to be updated to instruct users on how to enable experimental exports support in Metro:
    • If a user is using Expo, they need to follow these instructions to create their metro.config.js file.
    • Users will then need to add config.resolver.unstable_enablePackageExports = true; to their metro.config.js file.

This should fix errors users get where Metro cannot find Evolu's modules.

@steida
Copy link
Contributor

steida commented Sep 9, 2024

I will review it after the new sync and update docs. Thank you!

@ravanscafi
Copy link

Hello @samwightt and @steida 👋
I tried to install evolu with expo 52 and I wasn't successful.
I also tried with a fresh 51 install and nothing as well, even though I tried to follow the example here.
I am not sure why it doesn't work, but I think it's related to what is listed here in this issue.

Following the instructions here and manually editing the package.json files and using default in the exports of evolu packages got me to different errors, so I think this would partially help fix the issue.

Could I help fix the issue somehow? I just need a bit more context, as I am trying the project for the first time and I was only able to run the example here, but not being able to set up a project of my own.

@steida
Copy link
Contributor

steida commented Nov 17, 2024

Hi @ravanscafi. What is in the repo works. Just copy and paste configs etc., carefully. We will update Evolu for the last Expo soon.

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

No branches or pull requests

3 participants