I'm struggling to understand the correct way or BEST WAY to deploy nextjs app. I have a hybrid Nextjs website which I currently host on Azure App Service. So far I run
Looking from Nextjs documentation (which is kind of slim on this topic), seems that this is the right way to do it.
From my understanding tho, just the .next/
folder should be needed for production, since is the one that has bundled code. The pages/
, components/
and so on, should be used just on development mode.
I also found some other examples online that go in this direction. If i try to remove /pages or /components tho, I got error and the app cannot run any more.
Can someone confirm me what is the minimum file structures needed for Nextjs application on production?
UPDATE:
The error I get is first:
ENOENT: no such file or directory, i18n
When I add this file, then I get the error:
ENOENT: no such file or directory, pages/
i18n.js
is a configuration file for the packages next-tralsation
https://github.com/vinissimus/next-translate
I'm talking with the author there as well, it might be a problem on their end, but right now I just want to know if na hybrid Nextjs.js app in production should include pages/
folder.
I want to know if .next/
folder is enough for production deployment and if not, i would like to understand why.
There is an example of usage with Docker in official repo https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile But I guess it applies for non-docker environments too.
Basically, it builds application and only keeps this files and folders after that:
So no, pages
should not be needed after build for vanilla NextJs app, but it might be needed for something else maybe, like next-translate
package in your example, I am not quite sure how it using pages
and what for.