I have a pretty big monorepo, and adding node-linker=hoisted
to .npmrc
would have significant consequences. With the help of rnx-kit, I managed to configure Expo to work without changes to .npmrc
.
I haven't encountered any major issues yet, but I also haven't built or released a production version of my app, so we'll see how it goes.
-
Add the following dependencies to your
package.json
:{ "@rnx-kit/metro-config": "^1.3.15", "@rnx-kit/metro-resolver-symlinks": "^0.1.36" }
-
Update the
main
field inpackage.json
to:{ "main": "entry.js" }
-
Add the files included in this gist.
-
Perform a clean install of
node_modules
, and try running your app again. -
You might need to add EXPO_USE_METRO_WORKSPACE_ROOT=1 to your .env, or exporting it. Very unclear what it actually does.
The SPA that react-native-web
creates tends to be heavily cached, at least for me. Open the URL Expo provides in a private browser window for better results if you encounter any issues.
Using
rnx-kit
like this finally made pnpm doable with React Native. Thank you 🙏🏽