Open
Description
Cross-posting supabase/realtime-js#415 because I'm not sure you're monitoring the issues on the other repo :)
Bug report
- I confirm this is a bug with Supabase, not with my own application.
Describe the bug
When using @supabase/supabase-js
in an expo react native project, if I use the unstable_enablePackageExports
with the metro bundler, bundling fails with the following error:
To Reproduce
- Generate a new expo app
- Add
@supabase/supabase-js
as a dependency - Create a supabase client in the main
_layout.tsx
file - Run
npx expo customize metro.config.js
- Add
config.resolver.unstable_enablePackageExports = true;
tometro.config.js
- Add
ios.bundleIdentifier
toapp.json
- Run
npx expo run:ios
Repro repo: https://github.com/aldebout/supabase-expo-exports-issue
Expected behavior
No crash
Screenshots

System information
- OS: macOS
- Version of supabase-js: 2.45.1
- Version of Node.js: 20.16.0
Additional information
Opening here because the error message I got in my actual project was
The package at "../../node_modules/@supabase/realtime-js/node_modules/ws/lib/stream.js" attempted to import the Node standard library module "stream".
It failed because the native React runtime does not include the Node standard library.
Activity
practiv-wamci commentedon Sep 11, 2024
Is there any update on this? I've run into the same issue
adamwett commentedon Oct 12, 2024
I've also run into this when trying to use Storybook and Expo.
marcocondrache commentedon Oct 29, 2024
I'm able to run it by manually specifying
nodeModulesPaths
and settingdisableHierarchicalLookup
totrue
(in a monorepo setup).DanielVolchek commentedon Nov 28, 2024
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
patches/@supabase__realtime-js.patch
I then added the following to my package.json (for pnpm)
filipecabaco commentedon Dec 11, 2024
I've merged supabase/realtime-js#444 so
2.11.4-next.1
will have this code.I do need some help testing this change, if possible do override
realtime-js
insupabase-js
with this versionDanielVolchek commentedon Dec 11, 2024
Unfortunately doesn't seem to be working
Can also confirm that the package is overriden correctly

filipecabaco commentedon Dec 11, 2024
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?
DanielVolchek commentedon Dec 11, 2024
Not sure about expo but with pnpm I can do this and it works
filipecabaco commentedon Dec 12, 2024
I need to double check why we need the
ws
library 🤔gianpaj commentedon Jan 5, 2025
Same issue here.
the code is open sourced here: https://github.com/gianpaj/call-me-please
If you uncomment the
supabase
import and the Signup<Button/>
in thesettings.tsx
file, you'll see the same error messageOverwriting to
2.11.4-next.1
of@supabase/realtime-js
didn't work either :(This is the
metro.config.js
file for Turborepo mono repo setuphttps://github.com/gianpaj/call-me-please/blob/master/apps/expo/metro.config.js
aimachinedream commentedon Jan 18, 2025
Any update? I can't get past this issue as other parts of my project need unstable_enablePackageExports: true.
xStrixU commentedon Jan 20, 2025
@filipecabaco any updates?
12 remaining items