I am trying to deploy next.js app on Firebase hosting. But I don\'t understand which files to push to the server. When I run npm run build
and pushed the build fold
On package.json
you need to add npm scripts for building and exporting like.
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next export"
},
And then you can run
npm run build && npm run export
Next build will build your project for shipping and export will put your files ready for hosting on a static hosting server (like firebase hosting).
npm run export
will create an out/
directory and place all your files there ready for uploading.
Note:
If your app needs to generate dynamic pages at the runtime, you can't deploy it as a static app.
Read more