Next.js Discord

Discord Forum

Site runs slowly locally on site with ONLY static content

Answered
Birman posted this in #help-forum
Open in Discord
Avatar
BirmanOP
I was about to start adding content to a next.js site and noticed that the pages take a long time (like 2-3 seconds) to load when run on dev. I know it will run a bit slower on dev cause the bundle isn't minified, but this is absurdly slow. All of the content is static. The Link component is used so I would expect pages to be preloaded but that doesn't seem to be making a difference. Do you have any tips on what I can do to make the local development experience closer to what's on production so the pages aren't so painfully slow to load?

I have attached a video that shows how slow that really is. Also, here's the repo with just the site. Please run yarn && yarn dev to experience it.

https://github.com/zeckdude/site-assessment
Image
Answered by B33fb0n3
normally it's very slow (like 2-3 seconds) when you visit that path first. There, the whole page will be compiled first and only after the compile it is visible. So when you visit it again (without browser cache) it should load waaaay faster.

Also keep in mind, that most caching functions are disabled in dev mode.

If you want to know how it really fells to be in production, you can build your project locally using next build and after that next start to start your project. Like that you are in production and can see, how fast (or slow) it really loads
View full answer

2 Replies

Avatar
normally it's very slow (like 2-3 seconds) when you visit that path first. There, the whole page will be compiled first and only after the compile it is visible. So when you visit it again (without browser cache) it should load waaaay faster.

Also keep in mind, that most caching functions are disabled in dev mode.

If you want to know how it really fells to be in production, you can build your project locally using next build and after that next start to start your project. Like that you are in production and can see, how fast (or slow) it really loads
Answer
Avatar
@Birman solved?