Help Needed: EAS Build Failing for iOS in Monorepo Setup (Module Resolution Issue)
Hi everyone,
I’m running into an issue with my Expo project during an iOS build using EAS, and I’m hoping someone can help me figure out what’s going wrong.
The Issue:
When I run the build using eas build --platform ios --profile production, I get the following error:
This is strange because everything works perfectly fine when I run the app locally, in development mode. The issue only occurs during the EAS build process for iOS.
Project Setup:
• Monorepo Structure:
• The client app is in apps/wandrlust-client.
• The backend package (which includes the convex/_generated/api file) is in packages/backend.
What I’ve Tried:
• I’ve verified that the @packages/backend/convex/_generated/api file exists and that everything is working locally.
• I’ve tried clearing the cache (expo start --clear), rebuilding the backend package manually, and ensuring all dependencies are installed correctly.
• I’ve also reviewed the EAS build logs but didn’t find anything pointing to a clear solution.
Question:
Has anyone encountered a similar issue where a project works locally but fails during the EAS build, especially in a monorepo setup? Could there be something specific to the EAS build environment (like module resolution or cache settings) that I’m missing?
Any help or suggestions on how to resolve this would be greatly appreciated!
thanks...!
3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Sounds like the eas build --platform ios --profile production might resolve modules differently that development or other types of builds you're doing. How does this @packages path alias work, does that work for other imports of files not exported from their packages? Are you using
resolver.unstable_enablePackageExports
, which could cause this behavior? It's sometimes not possible to import a file from another package without it being a designated export. What does the package.json for the server package look like?
There are things you could do like exporting the api object from the backend package which could be necessary if files deep in the backend package can't be imported directly (e.g. when using ESM module resolution rules) but it's hard to know if they're necessary without knowing what's different about the this build.
Are you committing the files in _generated to version control if so? When you say you've checked that the files exist, have you done that in the remote build environment, with e.g. a shell command to check?found the issue! turns out the _generated folder was mistakenly added to .gitignore by one of my colleagues, which caused it to be missing during the EAS production build. After fixing that, everything is working fine now.
Thanks for the support!