next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Slow page reload running in development

Open bjrb20 opened this issue 4 years ago • 8 comments

What version of Next.js are you using?

10.2.0

What version of Node.js are you using?

14.15.4

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

n/a

Describe the Bug

When running npm run dev if you reload the page (refresh) a few times, after about the 5th refresh the load time gets very slow and almost unusable.

Expected Behavior

Refresh should be less than a few seconds.

To Reproduce

npx create-next-app app cd app npm run dev

Refresh the page 5-10 times.

bjrb20 avatar May 13 '21 17:05 bjrb20

Im having the exact same issue, but I can add some other things to take into consideration:

It gets stucked even when you dont manually refresh, after approximately 5 minutes using it with hot reloading or 5 minutes of inactivity. Sometimes it doesnt even work to kill the process and start it over and I have to do it repeatedly until it works. I have tested using it with NPM and YARN as well, and running "next dev" or only "next", deleted cache and node modules and install it again but no luck so far.

im using the exact same versions of the tools but working on Windows 10.

mazc28 avatar May 17 '21 12:05 mazc28

+1

Blessen avatar Jun 04 '21 16:06 Blessen

I have found a solution, dont know if its permanent, but here it is. Im using windows tho, so what I did was created an exclusion on windows defender directly on the project's folder and that was it. Windows defender may be causing this delay because of a deep scan it performs on some files within the folder, hope it can help someone.

mazc28 avatar Jun 04 '21 17:06 mazc28

I was unable to repro this but I'm on Linux. We will probably not dig into this so If anyone from the community is interested we would love to assist you in finding the root cause and review your PR with a fix.

Thanks mazc28 for finding out the thing with Windows defender.

jankaifer avatar Nov 29 '22 09:11 jankaifer

Can you link an example?

isaackatayev avatar Mar 27 '23 20:03 isaackatayev

I encountered the same problem as you described, and following mazc28's suggested solution, I was able to successfully resolve the issue on my Windows 11 system (Node.js v18.20.5). Thank you guys very much for sharing this probem and solution, it's very helpful for me a newbie.

If anyone encounters the same problem in a similar development environment, the following troubleshooting steps may be helpful:

  1. Open the Windows Security app.
  2. Click on "Virus & threat protection" on the left.
  3. Under "Virus & threat protection settings", click on "Manage settings".
  4. Scroll down to the "Exclusions" section and click on "Add or remove exclusions".
  5. Click on "Add an exclusion", and select "Folder".
  6. Navigate to the folder where your Next.js project is located, then click "Select Folder".

zarelloshake avatar Nov 24 '24 06:11 zarelloshake

@ijjk @balazsorban44 should we add this documentation, if so can you just point me to which page i should add this to and i will open a pr

husseinraoouf avatar Mar 31 '25 11:03 husseinraoouf

Hey! I’d like to work on this issue because I’m really interested in Next.js development tooling and performance, especially around the dev server experience. I’ve seen similar behavior in local development—where repeated refreshes lead to noticeable slowdowns—and I’d love to dig into what might be causing the memory or process overhead.

I want to explore whether this is related to caching, hot reload behavior, or potential memory leaks. It’s a great chance to improve the dev experience for others using older versions like 10.x. Happy to start investigating and share findings soon—let me know if there's any relevant internal context or recent related fixes to consider! 🚀

Mitch5000 avatar Jun 15 '25 08:06 Mitch5000

Hey @bjrb20 is this issue open if yes I would like to take this up

9140ankursingh-beep avatar Nov 05 '25 13:11 9140ankursingh-beep