firebase / firebase/apphosting-adapters
NextJS - If package.json has `build: next build` firebase deploy will fail
- Dominant language
- TypeScript
- Stars
- 478
- Forks
- 1.5k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 2
Description
The package.json cannot have the `build: next build` script or firebase function will fail to deploy. This is very reproducible and happens every time.
example package.json
```
"scripts": {
"dev": "next dev",
"build": "next build"
}
```
I've encountered this error when it's the final stages when the function is building.
`Error: Could not find 'pages' directory` , which is very vague and confusing, but after [figuring out a lot of issues](https://github.com/vercel/next.js/discussions/47699#discussioncomment-5514313) , I am perplexed why this is an issue.
I am using `src/pages` folder structure in NextJS.
firebase.json
```
{
"hosting": {
"source": ".",
"cleanUrls": true,
"ignore": ["firebase.json", "**/.*", "**/node_modules/**", "functions/"],
"rewrites": [
{
"source": "**",
"function": "ssrNextFunc"
},
{
"source": "**/**",
"function": "ssrNextFunc"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains; preload"
}
]
}
]
}
}
```
There seems to be a mismatch somewhere as if you try to override this with anything else eg. `build: next build src/` it will say this command will be ignored and firebase will use it's default and deploy will work.
BUT if it's `build: next build`, this doesn't get ignored, so I assume this means it must be matching firebase's build script, but the frustrating thing is that this will fail the deploy, and I do not know why for the life of me.
Contributor guide
Assessment
This issue has not been assessed yet.