NextJS baseUrl configuration not working on Github Actions

Viewed 416

I am using Github Actions to run CI and CD for my NextJS app (v9.4.4).

I currently have a jsconfig.json file as the following:

{
  "compilerOptions": {
    "baseUrl": "src"
  }
}

This is great as I can do import Nav from "components/Nav" in lieu of import Nav from "src/components/Nav" and is working perfectly locally (with either next dev or next build).

However, when I try to build the NextJS app on Github Actions, it errors with:

./src/App/index.jsx
Module not found: Can't resolve 'contexts/firebase' in '/home/runner/work/MyFirebaseApp/MyFirebaseApp/src/App'

For context, a sample of my file structure is:

MyFirebaseApp
│   .github
│   next.config.js
│   jsconfig.json
│   ...more config files...  
│
└───src
│   │
│   └───App
│   │   │   index.jsx
│   │
│   └───components
│       │   Nav.jsx
│   │
│   └───contexts
│       │   firebase.jsx

I have tried changing the baseUrl to home/runner/work/MyFirebaseApp/MyFirebaseApp/src without any luck.

Is there special webpack configuration or changes I need to make for this to build on Github Actions?

0 Answers
Related