Closed owenduncansnobel closed 5 months ago
Hey @owen-duncan-snobel I went down this rabbit hole as well.
I've finally been able to somewhat figure it out by:
// #3 - Force resolving nested modules to the folders below
config.resolver.disableHierarchicalLookup = true;
"main": "expo-router/entry"
in "package.json", creating an "index.js" file and using that as the main entry.import "expo-router/entry"
to the "index.js".The main issue I've been having is Metro not being able to resolve "expo-router/entry". I guess the resolution process is different for imports and the "main" field in package.json
. It also doesn't seem to work with hierarchical lookup disabled.
I can provide you with an example project setup later if you want. Btw I'm using the official tabs template for my app workspace and I'm also using pnpm with hoisted node-linker (as this repo does).
I can provide you with an example project setup later if you want. Btw I'm using the official tabs template for my app workspace and I'm also using pnpm with hoisted node-linker (as this repo does).
Ya if you were able to post an example of the setup later that would be amazing!
@owen-duncan-snobel Sorry it took so long. I got distracted by Diablo 4 lol.
Here you go https://github.com/tichopad/expo-monorepo-example/tree/main/apps/mobile-with-router.
It should work out of the box. Although I haven't tested EAS Build.
Sorry it took a while! Next time, do ping me on Twitter @cedric_dev.
Yep, @tichopad is right, disableHierarchicalLookup
shouldn't be disabled anymore. This used to be required due to various issues in both the native layers of React Native, as well as Metro. These have now all been fixed, and our docs has been updated to mention this too:
I also updated this monorepo to use Expo SDK 51, and removed this property. Hope this helps!
Description of the bug
Is there an example of getting "expo-router" working with this repo? I have been trying to add it but I am getting errors when trying to install it.