HowTo: EAS managed build in a monorepo on SDK 41

I know EAS isn’t available yet for managed projects, but wanted to share some notes since I was able to get things working with yarn, a monorepo, and a managed project.

  • SDK 41
  • expo-cli version: 4.4.1
  • eas version: eas-cli/0.10.0 wsl-x64 node-v14.8.0
  • yarn >=2.3.0
  • expo-yarn-workspaces no longer required
  1. Create a standard eas.json with the workflow set to managed
  2. In your package.json, add the installConfig option of "hoistingLimits": "workspaces" (see example below)
  3. In your .yarnrc.yml, enable the default node-modules linker: nodeLinker: node-modules
  4. eas build

There were two really awkward issues that come out of using a monorepo. First, older versions of yarn supported workspaces, but didn’t have first class support for managing your hoisting. While expo-yarn-workspaces worked locally, it seemed to confuse the build service during the managed + eject step. As of yarn 2.3, the team added nohoisting options you can place in your app’s package.json, making it much easier to simply turn off the hoisting in one part of your monorepo. The team even refers to React Native as a major motivator for this support. Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ... - DEV Community

Second, you’ll want the node-modules linker. I did some brief testing with yarn 2’s PNP / zero-install, but just found the builds to be more consistent with the node-modules linker.

If you were using expo 40 and eas, you’ll want to also clear your cache by setting your cache values in the eas.json, specifically for your ios build which might be caching old pod files.

I hope someone else finds this useful. It’s amazing to see EAS working, as there’s nothing quite like watching expo manage the whole release for you.

package.json section for limiting hoisting
In your app, add the following configuration option. It will tell yarn “for this workspace, don’t hoist anything”. It’s a yarn-official alternative to the workarounds we did with the older expo-yarn-workspaces module.

{
  // ...
  "installConfig": {
    "hoistingLimits": "workspaces"
  },
3 Likes