Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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):

  • just the .next/ folder?
  • node modules as well?
  • any source code?
like image 801
Merig Avatar asked Nov 02 '25 07:11

Merig


1 Answers

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.

like image 102
felixmosh Avatar answered Nov 04 '25 03:11

felixmosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!