Comments (7)
Confirming @EvanBacon's suspicions, @firebase/auth specifies top-level "react-native"
and "browser"
fields in its package manifest, which causes Metro to select the dist/rn/index.js
module (which does not export browserLocalPersistence
).
Workarounds for app devs
-
If the project is web-only, overriding
resolver.resolverMainFields
to a value of['browser', 'main']
will no longer resolve"react-native"
exports across packages. -
Configuring
resolver.resolveRequest
as documented will allow you to set a specific override for imports of'firebase/auth'
βΒ perhaps to either of the following files withinnode_modules/@firebase/auth/
."browser": "dist/esm2017/index.js", "cordova": "dist/cordova/index.js",
Follow-ups
- On the Firebase side, submitting a PR updating
index.rn.js
in @firebase/auth to exposebrowserLocalPersistence
(citing that this enables use in react-native-web) will fix this issue for others under Metro's current behaviour. - On the Metro side, we are actively reviewing the behaviours of the top-level
"react-native"
and"browser"
package.json fields. The rollout of Expo Web with Metro is making issues like this visible, which may motivate us towards a short term config escape hatch β before a revision to this behaviour (where we will not overlap"react-native"
and"browser"
) coming with support for package"exports"
.
from router.
Unrelated to the router, but my first guess would be that firebase is using react-native
import fields in the package.json
and don't account for Metro web. I'm not sure if Metro allows for swapping the resolver main fields dynamically based on platform but I could check.
from router.
Thanks so much for your time: @huntie
It's a web+native project. I will try the 2nd workaround(resolver.resolveRequest) for now :)
created a PR on firebase side: firebase/firebase-js-sdk#6683
from router.
@Albert-Gao I'm struggling with this one too, as there's sparse examples for how to use metro resolver.resolveRequest. Our use-case is to have signInWithPopup and signInWithRedirect from firebase/auth. As of [email protected] it stopped working.
resolverMainFields works without EXPO_METRO_NO_MAIN_FIELD_OVERRIDE for me on web.
We have a native app too though so the first option is not viable.
Could you share what you used for resolveRequest?
from router.
Indeed, not related to the router directly, but since the metro is a critical component of expo router. I posted here π will do more digging later
from router.
Updated the example to the latest version and cross-posted this issue in metro repo :)
facebook/metro#878
from router.
Thanks for the fix! @EvanBacon
https://github.com/expo/expo/pull/19529/files
according to the code, it should be fallback to the preferredMainFields
when EXPO_METRO_NO_MAIN_FIELD_OVERRIDE ===false
however, I tried it, still undefined
I am using this script,
{
"scripts": {
"web": "EXPO_METRO_NO_MAIN_FIELD_OVERRIDE=false npx expo start --dev-client --web"
},
}
What am I missing here? :)
from router.
Related Issues (20)
- why is the dev server generating .gitignore HOT 1
- eas update fails with web: {...output: static,...} HOT 1
- Navigation Stack Issue with Incorrect Event Display HOT 1
- _layout inside a (tabs) folder throws error in navigation and gives me a blank screen HOT 5
- Bad start-up navigation with expo prebuild HOT 4
- Navigation twice on the first screen of a modal (only in production app) HOT 6
- Migration to expo-router-v2 breaks onLayout redirect HOT 2
- Template tabs@48 is broken HOT 3
- Metro has encountered an error: While trying to resolve module `stylis` HOT 2
- Expo Router V2 breaks when calling hook on destination page HOT 5
- Expo Router V2 Web - ScrollView in nested navigation is not showing up HOT 5
- Unable to nested dynamic route under shared HOT 5
- listeners prop do not have types
- Metro has encountered an error: While trying to resolve module stylis HOT 3
- TypeError: (0 , _stylis.middleware) is not a function HOT 4
- Navigation between screens in different tabs does not work HOT 7
- Impossible to change router background in dark theme HOT 3
- Push notifications do not work when received. HOT 1
- Not able to pick initialRouteName in Expo Router when using stacked navigation HOT 2
- useFocusEffect cleanup - This expression is not callable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from router.