Sebastian Garrido
Sebastian Garrido

Reputation: 311

Monorepo with Expo and Multiple Entry Points

I have two Expo (React Native) apps that share most of their code and are already in production. We are trying to move them to a monorepo directory structure as follows:

lerna.json
package.json
packages/
    mobile-1/
        app.json
        index.js
        package.json
    mobile-2/
        app.json
        index.js
        package.json
    mobile-common/
        src/
            ... actual app code ...
        index.js
        package.json

The way our setup works is that we export a function that starts the app from mobile-common/index.js and mobile-{1,2}/index.js are supposed to call this function with initialization parameters specific to each of them.

The problem with this setup is that mobile-common makes use of react-native and expo dependencies, which are also required by exp to start the React Native packager which causes certain issues at build time. We tried the following:

We really want to move to this kind of structure because our previous structure didn't easily allow us to run both apps side by side, and it is becoming increasingly necessary.

Thanks for helping us out!

Upvotes: 4

Views: 2341

Answers (1)

Simon Mo
Simon Mo

Reputation: 773

If you want to setup expo with a monorepo you can look at my example here.

Currently the expo packages must remain in the root package.json because of limitations with watchman not resolving symlinks properly.

Upvotes: 1

Related Questions