Absolute paths for React app on Github CI with Firebase hosting

Viewed 300

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?

1 Answers

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.

Related