An update on ArchNoob's answer:
As of Next.js v13.4.19,next export
is no longer needed, next build
would suffice if you just have output in next.config.js
like this:
const nextConfig = {
output: 'export'
};
Further Upadate:
If want to build + export to out
folder, then understand the routing and configure as per what Monasha said it's cool, it will be a good learning.
But there is a new feature released from firebase hosting for lazy people like me, it solves all these on it's own, you don't need to bother about export folder nor directory structure.
You just have to do firebase experiments:enable webframeworks
Once it detects the current directory as a nextjs project it will do all those on its own. You just do firebase deploy
after that and you are done.
More details : here
Now firebase hosting for nextjs is at par with vercel or netlify.