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
- npm build
- npm start The app compile with no error and I host on Azure all the content of my application which contains
- .next/
- components/
- pages/
- ...all configs
- ..all js files
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.