Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory footprint with different start commands #103

Open
karlhorky opened this issue Jul 14, 2023 · 0 comments
Open

Reduce memory footprint with different start commands #103

karlhorky opened this issue Jul 14, 2023 · 0 comments
Assignees

Comments

@karlhorky
Copy link
Member

karlhorky commented Jul 14, 2023

From Tim Neutkens:

One quick optimization you can do for your app is removing pnpm start and using output: standalone or changing the command to ./node_modules/.bin/next start instead, that saves about 50MB in RSS

The output: 'standalone' docs say:

Next.js can automatically create a standalone folder that copies only the necessary files for a production deployment including select files in node_modules.

This will create a folder at .next/standalone which can then be deployed on its own without installing node_modules.

Additionally, a minimal server.js file is also output which can be used instead of next start. This minimal server does not copy the public or .next/static folders by default as these should ideally be handled by a CDN instead, although these folders can be copied to the standalone/public and standalone/.next/static folders manually, after which server.js file will serve these automatically.

@karlhorky karlhorky changed the title Improve deployed memory footprint with different start commands Reduce memory footprint with different start commands Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants