Module "11" is missing

Just reporting that I created a brand new monorepo. Installed a brand new test app with expo init testApp (SDK40 and selected the tabs typescript template):

yarn add --dev expo-yarn-workspaces in the test app dir.
Added a postinstall script to the monorepo main package.json like so:

{
  "private": true,
  "name": "monorepo",
  "version": "1.0.0",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "testApp": "yarn workspace @monorepo/test expo start --clear",
    "postinstall": "cd ./packages/testApp && expo-yarn-workspaces postinstall"
  },
  "workspaces": [
    "packages/*"
  ]
}

Added this to the testApp app.json:

"packagerOpts": {
  "config": "metro.config.js"
}

And of course added metro.config.js file to the testApp root dir with

const { createMetroConfiguration } = require('expo-yarn-workspaces');
module.exports = createMetroConfiguration(__dirname);

Started the metro server with yarn testApp and I’m getting Module "11" is missing from the asset registry

not sure what is going on with your project but i suspect something isn’t configured correctly.

here is a working example of a fairly minimal monorepo that i put together quickly for you, so you can compare: https://github.com/brentvatne/expo-monorepo-example

1 Like

@brents thanks a lot for putting this together. Very helpful!
Yes, this one works perfectly. And I like the organization into apps and packages folders. I haven’t seen this documented anywhere, including the original docs and it’s very neat.
I think it would be helpful if your example repo was referenced in the README, or added directly to the repo.

i actually copied the structure from how we organized the expo/expo repo :slight_smile: notice that in packages we have all of the expo-* packages, like expo-camera etc, and in apps we have some actual apps that we use for internal testing.

i think a good place for this might be https://github.com/expo/examples - and we could link to it from the expo-yarn-workspaces readme. this way, people can initialize from the template with npx create-react-native-app -t with-yarn-workspaces or something like that :slight_smile:

are you interested in opening a pull request to that repository with this example?

Great idea. Yes, I’ll create a pull request. Just never created a pull request before so I need to first learn how :blush: Will keep you posted.

Brent, I’m sorry, I was planning to tackle this now. I was delayed with the holiday celebrations and working on making my own monorepo work. I just saw that a PR for the monorepo already exists.

i reviewed that pr and gave feedback that would have been needed to merge and didn’t hear back in 2 months, so i think it is safe for you to proceed with your own pr

Done.
This is the first time I forked any repo and created a PR, so please excuse the mistakes, if any :blush:

1 Like

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