#App directory - UNBEARABLY slow compilations during development.

7 messages · Page 1 of 1 (latest)

glad forge
#

So, I've been using Next.js professionally and privately for several years now and am quite fond of it.

With the app dir being "stable" I made the leap and used it in a greenfield project. What I've noticed is that the compilations locally are extremely slow. Since I've never faced a similar issue, I'm not sure where to start to look if the obvious ones don't solve it.

  • How does one debug long compilation times?
  • What is usually the culprit?
  • Have I missed a config somewhere?
  • Is it the dependencies, if so how do I debug?
  • Modules that get updated is watch but shouldn't?
  • Tailwind config?

Example repo (not mine) but very similar setup: https://github.com/batuhanbilginn/supabase-nextjs-server-auth

- wait compiling...
- event compiled client and server successfully in 3.9s (1859 modules)
- wait compiling...
- event compiled client and server successfully in 8.9s (1859 modules)
- wait compiling...
- event compiled client and server successfully in 1644 ms (1842 modules)
- wait compiling...
- event compiled client and server successfully in 816 ms (1842 modules)

I'm using a Mac mini m1, 16gb ram.

Dependencies from my package.json is attached.

GitHub

Contribute to batuhanbilginn/supabase-nextjs-server-auth development by creating an account on GitHub.

maiden kite
wooden leaf
#

I think you guys are looking for this

#

Possibly?

#

Just from looking at the module count alone

stable anvil
#

I am not an expert at all in nextjs but we had the same problem with our app. it drove me crazy. I did notice however this occured during certain development so I spoke with the BE guy about ti and after the initial denial he looked into it and "fixed" it probably in 70%. he told me he cut the number of FE-BE inquiries by 50% that were happening. We also switched to yarn from npm, which cut the time maybe by 20% but always something. I personally also looked into the number of pluggins i had running in vscode and deleted most that I did not need - this helped another 15% as well. Overall, I am probably 70% back to "old" comilation time, which is bearable. hope that helps bud. ah, btw. we also did try the "stable app" folder but we went back to old pages because there were always some edge cases with something.