next.js: Compilation time extremely slow (Next > 12.0.9)
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:42 PST 2022; root:xnu-7195.141.26~1/RELEASE_ARM64_T8101
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.2.3-canary.4
eslint-config-next: 11.1.3-canary.7
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
After updating the next
package from version 12.0.9 to 12.2.0 and above, the next dev
compilation time extremely slow.
I tried to use compilation with SWC and with babel, the result is the same.
nextjs 12.0.9:
compiled client and server successfully in 3.4s (577 modules)
trace: https://gist.github.com/R1ZEN/2d032dba11947ac3b48ecfe9a4e1008d
nextjs 12.2.0:
compiled client and server successfully in 46.8s (667 modules)
trace: https://gist.github.com/R1ZEN/36445c707eb0e50a58cccd05af2ac19f
Expected Behavior
Compilation time would be the same or faster
Link to reproduction
I don’t have a reproduction that I can share at the moment
To Reproduce
I don’t have a reproduction that I can share at the moment, but might have some time to come up with one.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (5 by maintainers)
I noticed the exact same thing running
dev
now. I upgraded from 12.1.5 to 12.2.5, I now see two " compiled client and server successfully", the second one much MUCH slower than the first – we are talking more than x50 to x100 times slower, almost 2 minutes, mybuild
takes only about 7 seconds in comparison.@balazsorban44 This is also on MacOS. More specifically, MacOS 12.3.1 (Monterey) with a MacBook Pro (16-inch, 2021) M1 Max.
Essentially the exact same thing as reported in Why does it compile twice? (second time always much slower) · Discussion #39901 · vercel/next.js
UPDATE: I downgraded and locked to 12.2.4 and this slowdown is gone, so this “issue” seems to have been introduced in 12.2.5
@ijjk Thanks, this is solving the issue for me
The issue has been identified by a user and linked to a recent PR, see my comment here. Feel free to share your experience as well. Hopefully the Next.js people can provide a workaround.
@balazsorban44, I added you to a repo where the issue is consistently reproduced.