-
-
Notifications
You must be signed in to change notification settings - Fork 377
Can't use with unstable_enablePackageExports metro option (expo) #1258
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
Comments
Is there any update on this? I've run into the same issue |
I've also run into this when trying to use Storybook and Expo. |
I'm able to run it by manually specifying |
This solution didn't work for me I was able to fix it by patching @supabase/realtime-js to match supabase/realtime-js#426 patchfile looks like this
named I then added the following to my package.json (for pnpm)
|
I've merged supabase/realtime-js#444 so I do need some help testing this change, if possible do override |
so this is happening during the bundling process of Expo, is there a way to configure which package to remove from the bundling process in some sort of configuration? |
Not sure about expo but with pnpm I can do this and it works
|
I need to double check why we need the |
Same issue here.
the code is open sourced here: https://github.com/gianpaj/call-me-please If you uncomment the $ pnpm list --depth 1 | grep supabase
@supabase/supabase-js 2.47.10
├── @supabase/auth-js 2.67.3
├── @supabase/functions-js 2.4.4
├── @supabase/node-fetch 2.6.15
├── @supabase/postgrest-js 1.17.7
├── @supabase/realtime-js 2.11.2
└── @supabase/storage-js 2.7.1
$ pnpm list --depth 0 | grep expo
@expo/metro-config 0.19.8
expo 52.0.23 Overwriting to This is the |
Any update? I can't get past this issue as other parts of my project need unstable_enablePackageExports: true. |
@filipecabaco any updates? |
Has it been solved? couldnt find anything |
not yet unfortunately as removing ws package has proven not to be enough ... any other clue on what it could help? |
So far the only thing that worked was setting unstable_enablePackageExports to false, though i dont know what consequences it could have on my project. Im currently using create-t3-turbo but with expo 52, and it got it to work but now nativewind has broken. |
Doing this in a monorepo breaks the import of packages in the monorepo: For the tailwind thing probably just update it, also update the I've tried everything mentioned in here but haven't figured how to make it work. I've got another repo where its working but its much simpler, haven't figured out what breaks it as both are based on the |
I have updates regarding the nativewind issue. Turns out it was another dependecy called react native reusables which created a tailwind.config.js file when the monorepo already uses a tailwind.config.ts file on apps/expo, so its was just a matter of merging those configs and it worked. On the other hand, i unfortunately had to uninstall supabase since expo 52 wont compile at all. Have you tried cloning a fresh copy of create-t3-turbo (Julius just updated some packages like expo and more recently) and installing just supabase to see if it even runs? i swear, nextauth is just the worst thing ever even if somehow you manage to get it working, it just finds a way to f with you every time. Im desperate to try supabase auth on my app. To be fair, when i set unstable_enablePackageExports to false it did not cause the |
New update: I got it to work out of the box! Clone the latest version of create-t3-turbo, follow the tutorial at https://supabase.com/docs/guides/getting-started/tutorials/with-expo-react-native?queryGroups=auth-store&auth-store=async-storage to do the supabase setup and it'll work. Tried it twice and no metro issues, no nothing and without having to set unstable_enablePackageExports to false Just in case do a So far i've only tried supabase auth but will update this when i try realtime and other supabase products. If you dont work in a monorepo you can just follow how expo is set up at apps/expo and it'll work too. |
This didn't work out for me, tried it by cloning it and following the guide you provided and haven't been able to get it working. |
This fixed the issues I've been having: config.resolver.unstable_conditionNames = ['require', 'default', 'browser']. For me, adding 'browser' has fixed it so far. |
Sorry for the radio silence on my side. @IamJoshing is there a explicit explanation why this works? it could help us understand what we need to change in realtime-js to properly fix it. |
I have no idea. I tried it after everything else had failed. I found some other examples of metro configs on the Expo Discord with more condition names. I added in the condition names that I didn't have. It worked. Then I removed them individually until I knew it was 'browser'. If this works for others, maybe someone at Expo can give you an answer as to why. |
Yes, that's correct. Just wanted to confirm this works and send a snippet to fix it here. // metro.config.js
const config = {
resolver: {
unstable_conditionNames: ['browser'],
unstable_enablePackageExports: false,
}
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config); |
Just stumbled upon this as was facing this issue (using SDK 53 beta). This behavior is expected: Metro’s support for Node‑style conditional exports now strictly honors the configured “conditions” (require, import, etc.) when resolving a package’s exports field, and it will only consider the "browser" entry if you explicitly include "browser" in its condition list. This change comes from Metro bundler and mentioned as a breaking change https://expo.dev/changelog/sdk-53-beta. |
you saved me, thanks a lot!! |
I just came here for Expo SDK 53 + Supabase combo and want to confirm this works:
Although I rewrote it as:
|
is there any solution about this bug??? |
I can't disable package exports since I use this feature in my mono-repo project, instead, I added this config: // metro.config.js
const config = {
resolver: {
resolveRequest: (context, moduleName, platform) => {
if (moduleName === "ws") {
return { type: "empty" };
}
return context.resolveRequest(context, moduleName, platform);
},
},
} |
we're releasing a |
Cross-posting supabase/realtime-js#415 because I'm not sure you're monitoring the issues on the other repo :)
Bug report
Describe the bug
When using
@supabase/supabase-js
in an expo react native project, if I use theunstable_enablePackageExports
with the metro bundler, bundling fails with the following error:To Reproduce
@supabase/supabase-js
as a dependency_layout.tsx
filenpx expo customize metro.config.js
config.resolver.unstable_enablePackageExports = true;
tometro.config.js
ios.bundleIdentifier
toapp.json
npx expo run:ios
Repro repo: https://github.com/aldebout/supabase-expo-exports-issue
Expected behavior
No crash
Screenshots
System information
Additional information
Opening here because the error message I got in my actual project was
The text was updated successfully, but these errors were encountered: