Yarn workspaces with Expo 31

Is there a way to get an Expo 31 project working with yarn workspaces? I had everything working fine with Expo 30, but metro has had major upgrades.

Note: we used https://github.com/viewstools/yarn-workspaces-cra-crna with Expo 30 (and previous SDKs) which worked fine with metro 0.30. The configuration for rn-cli.config.js has changed so dramatically (particularly the removal of multiple project roots), that I don’t know the first steps to get this working.

Alright, I seem to have found a way to do this without having a custom rn-cli.config.js at all.

Main things that were done:

  • Within prestart script, use crna-make-symlinks-for-yarn-workspaces to symlink expo and react-native within node_modules
  • Remove main from package.json, as the default AppEntry.js points to an improper path.
  • Add a new entrypoint.js, which is a copy of node_modules/expo/AppEntry.js, but with fixed path to App.js
  • Add entryPoint to app.json, pointed at the path to entrypoint.js, relative from the root of the repository (not the workspace)

See https://github.com/bumped-inc/test-expo-monorepo

I believe that it is treating the entire repository as a project root and the haste module system is picking up the workspaces within that.

This does lead to warnings with asset paths (not sure if harmful in production), as well as some complications with jest.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.