-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
long compile times locally - along with "JavaScript heap out of memory" since upgrade to NextJS 13 #45529
Comments
can second this, been taking forever to switch routes and 30s compiles out of the blue, can't seem to find a fix |
@ChristopherTrimboli just curious, could you share your dependencies? mine are:
|
Same. 30s compile/refresh times, navigating is also super slow. I have to hard-reload the page many times because the refresh doesn't work or is too slow. Sometimes I also have to kill and restart the Uploaded build trace: trace.txt Dependencies:
|
Looking at the dependency list both have either In this case can you make sure to delete Additionally: Are you referring to the |
@timneutkens thanks for taking a look. Here's a new trace following your instructions: trace.txt My application is |
@mpereira Could you share the output of |
You can visualize the trace yourself using https://github.com/vercel/next.js/blob/canary/scripts/trace-to-tree.mjs |
@timneutkens I'm on macOS:
I don't know if it's incidental, but I also noticed that the dev server was faster after nuking the build directory and restarting it (reflected in the last trace file I attached). |
also on macOS, what I found:
instead of
As is recommended in https://mui.com/material-ui/icons/#usage. TIL ! I also had a bunch of places where I did the same with mui such as I then compared a trace before and after, here's a snippet from before:
2.4s to load an icon. Seems awfully unusual since that page was already in the recommended import in the after trace
I did take this opportunity to fix all the other recommendations for the imports I had wrong with @mui/material. The speed is certainly much better! I wonder if all the inefficient imports were just slowing things down overall which would cause seeming ly unrelated icon imports to take longer. The trace and the next.js script to visualize it is incredibly helpful! I see a few other things that take > 1s so I can dive into those. Curious if other folks encounter the same findings. |
Here's a project-wide grep for
|
I have the same problem.
npx next info
node trace-to-tree.mjs .next/trace
|
Hi everyone! Having the same problem. I use
I don't experience just slow build, but also very slow navigation between pages. Everything is fine on production however. Situation slightly improved for me when I've changed the method of importing the Before: After thus change my build time decreased to approx 1.5s (much better, even though still not ideal), navigating between the pages also feel a bit faster. The
|
I'm also encountering super slow build times and page transitions with the @timneutkens here's my trace: trace.txt I'm not using |
Same when using @icon-park/react |
@jamesvclements try adding a next.config like below, (this helped me reduce from 20k modules to 500):
|
I'm having a similar situation. We've migrated from v12 to v13 and now the compile times became really long. I takes more than 60 secs to compile a page. Using app dir. Here I have a the trace trace.txt. Dependencies:
Anyone could solve this? |
@federicolopezeikilis had a look at the trace for your application. The main cause seems to be two issues:
Some observations:
|
@jamesvclements had a look at your trace. Observations:
|
Hello @timneutkens I turned off the windows defender and changed the postcss to the default file provided by create-next-app boilerplate, but it still take a long time to compile. Here you have the new trace: trace.txt Regarding the react-use issue you mentioned ("react-use is imported which seems to be a barrel file with 113 re-exports which are all compiled regardless of if you're using a single method"), what do you propose to solve it? We used next12 for a long time before in this project and we hadn't had any problem like this with the compiling time. What's your take on this? |
let's hope that 13.4.5 fixes it, I see lots of performance commits coming in Canary: #50792 |
hi @timneutkens i am a colleague of @federicolopezeikilis and i have brand new macbook pro. and i experience a similar abnormal compiling time. no so much, but around 30s or even more. here is the trace file: trace.txt as @federicolopezeikilis stated, this was not happening in next 12, so we understand that there is something else (maybe something not detected yet?) in the next 13 building process that is causing this long delays in the building / compiling times. we can see in the console that apparently compiling is short (in my mac), but when if first load a page in the app, it takes very long to be processed and consequently shown on screen. we appreciate your help on this topic, as for us is right now a noticeable inconvenient for the development team. |
I'm going to consolidate all of these issues into one issue given that they're all roughly the same. Closing in favor of #48748. Please see this comment: #48748 (comment) @federicolopezeikilis @manuelbarzi I'll reply to both of your comments over there. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://github.com/auction-engine/live
To Reproduce
npm run dev
then attempt to navigate to pags using will take on average 10 seconds.Describe the Bug
Basically when I develop locally with
npm run dev
I get long compile times (10s+) [0] and very slow route change times (click a link, wait 10s before route changes.) This all has happened since migrating to the new apps directory with NextJS 13. I also recently had several "JavaScript heap out of memory" crashes [1], all is well with prod.I have repo in a private repository I'm happy to share access
[0]
[1]
Expected Behavior
Would expect fast load times and navigation as I see in prod and how it was locally prior to NextJS 13.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: