I'm almost done with my first ever Next.js app.
Dev was always somewhat slow to load, but production is absolutely ridiculous.
On first load it takes 30+ seconds for the home page to render.
I've seen really slow sites take 5-10 seconds, but what could I possibly be doing wrong that would lead to 30 second load times?
Is prefetch a huge performance killer?
Next. js has two modes. The development mode ( next dev ) is pretty slow, since a lot of development tools are executed and shipped. To run your app in production mode first build it with next build and then start it with next start .
First of all you need to find out what is making your site slow. For that I recommend lighthouse or the network tab of your development tools.
Next.js has two modes. The development mode (next dev
) is pretty slow, since a lot of development tools are executed and shipped.
To run your app in production mode first build it with next build
and then start it with next start
.
Sometimes developers include gigantic npm modules or even modules that only have been build for node.js into next.js.
Finding these modules is actually pretty easy thanks to these examples:
If you are running your next.js instance on a serverless provider keep in mind that it may take some time to start the serverless instance. Especially if you have a free plan.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With