1

I am building react native mobile app via npx eas build -p android with expo 49. This error is just related to path while building hence I haven't included environment info in detail. App is running fine in simulator othewise. Someone with prior similar experience should be able to figure this out. I am open to provide details if required.

I am able to run app in ios and android simulator by running npx expo start --ios and npx expo start --android just fine. However when I try to build using eas it fails for the error:

Error: Unable to resolve module ./shared-lib/App from /home/expo/workingdir/build/App.js:

None of these files exist:

  • shared-lib/App(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)

  • shared-lib/App/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)

1 | import App from './shared-lib/App';

|                  ^

2 | export default App

Error: Unable to resolve module ./shared-lib/App from /home/expo/workingdir/build/App.js:


Now I tell you what I am doing. I have got a shared-lib directory parallel to App.js and index.js in root. I am using shared-lib folder as a git submodule to be used in multiple apps as a common code base. I am including shared-lib/App.js inside root App.js like:

import App from './shared-lib/App';
export default App

I am attaching a folder structure here:

enter image description here

I am including files from shared-lib in all over the project. For example this is in ./LoginScreen.jsx

....
import ForgotPasswordLink from '../shared-lib/ForgotPasswordLink'

....

import {apiConfig, style as __style, fonts as __fontf} from '../shared-lib/config';

How do I make builder to know about the use of shared-lib in my project so that it can build successfully?

1
  • It was my mistake. I was building using expo command eas build. Since the shared-lib was listed in .gitignore it was not being bundled in the build. I removed it from .gitignore when running eas build and it worked! Commented Nov 7, 2023 at 5:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.