-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Libraries that use nullish coalescing don't work on Expo web #19677
Comments
Thank you for filing this issue! |
We are blocked from using expo because of this. The quick fix led to more errors. We might be able to resolve them, but it's not looking good right now. We get issues with |
Same issue, EAS fails when bundling for iOS for a project using Tinybase. Are there any workarounds using babel.config.js? |
Any update on this ? Pretty big problem if you want to use something like trpc. |
The nhost client is also affected. nhost/nhost#1607 |
I could make it work with @gabrieldonadel's babel fix. However, it seems that it also fails for iOS (and Android) as well. I have this test repo: https://github.com/beepsoft/nhost-js-expo-web-problem2 If I run it in the iOS simulator it will fail at
because of a ?? operator. Is there maybe an equivalent of |
Summary
It seems that Expo web does not support libraries that use nullish coalescing (
??
), from my testing this seems to only affects libraries and using??
inside an expo project works as expected. I imagine this happens because expo code is transpiled by babel and node_modules are not.This is the error that I get when trying to use a lib with nullish coalescing
This same library works just fine on Android and iOS. I would like to confirm if this is a bug or if it is expected from libs to treat this if they want to support Expo web
What platform(s) does this occur on?
Web
Environment
Minimal reproducible example
Weirdly enough this works just fine when using snack -> https://snack.expo.dev/@gabrieldonadel/387b69, I guess they have their own custom
webpack.config.js
Locally reproducing this is just a matter of importing a library that uses nullish coalescing, e.g. rn-material-ui-textfield
Code Example
npx create-expo-app test-rn
npx expo install react-dom react-native-web @expo/webpack-config
to add web supportnpm add rn-material-ui-textfield
Temporary workaround
Update your
webpack.config.js
file (or create it if you don't have one) to make babel transpile the library that you're facing issues with, e.g.The text was updated successfully, but these errors were encountered: