Absolute paths for React app on Github CI with Firebase hosting

412 views Asked by At

After switching to use absolute paths, although my local builds still work fine, Github CI build fails with this error:

./src/App.js
Cannot find module: 'components/Layout'. Make sure this package is installed.

How can I make Firebase/Github CI also search the src directory?

2

There are 2 answers

4
Sergey Semashko On

Creating jsconfig.json with the following configuration should do the trick:

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": [
    "src"
  ]
}

I've tried creating a sample repo with the setup you mentioned and GitHub actions (I hope this is what you meant by GitHub CI) job did create build properly.

0
Tran Minh Tri On

"Figured out my mistake. I had some files that were lower case in remote but upper case in local. My filesystem is not case sensitive, so local builds didn't fail, but CI runs on ubuntu which is case sensitive." - Arash

This is the solution, I have the same error and can fix it by doing the above.