buildweb-deploymentnext.js

Necessary files in Next.js build


I wrote a Next.js app and I'm close to deploying. I would like to know what are the strictly necessary files to copy on the server to deploy while keeping it SSR (not statically generated with next export):


Solution

  • Copy .next folder with package.json && npm install --production should install only the dependencies of your app.

    Keep the folder structure.

    Side note, it is bad practice to copy node_modules between environments because there are some packages that are os specific.