-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
Compiling too slow on next 9.4 #12797
Comments
Could you please give us a full reproduction? We'll need it to reproduce and track this down. 🙏 |
@Timer Its a private codebase.
It takes too long to compile even for a page with a single div. Can you tell me what other details should I share? |
Sorry, but we'll need a full demo to provide any more insights. You can try to reduce your app to a single page without private data. |
I'm having the same problem |
1 similar comment
I'm having the same problem |
Hi everyone! Replying with "+1"s do not help us prioritize this issue any quicker. If you'd like us to fix this problem, please provide a reproducible demo. Thanks! |
Hey @Timer, Steps to reproduce:
|
Thank you! We'll look at this soon. |
Thanks @Timer I'm having the same issue here with a very small project too... |
@mahmoudm-mvsi, As said by @Timer:
Your comment does not add to this issue and is the equivalent to saying |
Could everyone please try |
@Timer It is resolved in |
For those curious, this was caused by Windows Defender. Windows Defender was delaying the HMR (to do a scan) because our emitted JavaScript files contained the word |
That's interesting! |
@Timer It's fixed now, thanks! But I'm on MacOS 10.15.4! |
Just checked #5598, interesting. On the first try it seemed to be fixed but I'll keep a track on this (not using nextjs currently for any active projects). |
We're planning on fixing it as part of webpack 5, which is coming 🔜! |
I'm really curious to know how did you find out about that! lol |
Profiling together with @sokra |
Wow, this issue saved me a headache, thank you @Timer!!! It looks like HMR was disabled by Windows Defender: when on, Next was doing a full rebuild / page refresh, ~20 seconds vs ~1 second. Huge diff. Here's where you turn it off: click the Manage Settings link in Settings > Security > Virus & Threat Protection. Note that it says it will turn itself back on after some amount of time. Anyone know how to configure it? I dug around in Control Panel and couldn't find anything. |
Wondering if this issue might be key to fixing this? Obviously we don't want to have to disable security on our machine just to use Next! #14266 |
That is the correct issue to follow, @mosesoak! |
Cool thanks. Just found out from a very smart friend that you can fix the issue more cleanly by leaving Defender turned on but setting your project folder as an Exception: (Scroll down on the Virus & threat protection settings page to find this) Add:
|
Hi guys! Firstly thank you for your awesome support always!! @Timer @timneutkens Tested in Ubuntu and it works well. Package Json:
next.config
.babelrc
|
webpack-hmr is only an eventsource connection that stays open hence why the time keeps running, it's unrelated to webpack compilation times. |
I just want to add a comment here although it is definitely not the problem that others faced. I was having slow compilation time on Ubuntu. The problem was that I had graalvm installed and the "node" binary that was getting executed was the one provided by graalvm. Removing that from the $PATH solved the issue. This might help someone. |
but I'm using Ubuntu. |
Everyone I've been having the exact same issue for a long time and tried every possible solution I could find on the internet. My project uses quill, ckeditor, less, ant design for third libraries and had to configure next.config.js for them. I haven't been able to find an alternative to fasten things up with these configuration. |
My project took around 30sec for a page to compile and it took around 10 seconds for hot reloading, also the ram usage was very high (4 Gb on mac) and after a while I ran into
Example usage:
So I did that and the ram usage decreased by 3 Gb and the compile time decreased as well and now everything is ok. My project was ok on react and I don't know why next has some problems with importing a single value from a large module. |
I've tried all these mentioned methods none of them worked on my situation. Developing in nextjs is becoming a pain. Can you guys improve this on windows we are suffering and its stressful spending half of a day staring on the browser waiting for the code to compile only to find out that you have an error. Im coming beck to nextjs when this bug is fixed, for now let me use gasty and react. |
Hello same issue here im on mac m1 chip ... i have to close my chrome and reopen for fast compile ... |
FYI I'm tracking a new thread here: #29559 (comment) |
Maintainer update
Please see #29559 (comment)
Bug report
Describe the bug
Hello, I just upgraded next from 9.3 to 9.4 today. It seems that compiling a single page takes too long. More than 3 minutes. Sometimes it never compiles too.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
next dev
and start the serverlocalhost:3000
Expected behavior
It should compile the page faster (usually 5 to 10 seconds) and load the page.
Screenshots
System information
The text was updated successfully, but these errors were encountered: