Next.js Discord

Discord Forum

Nextjs is awfully slow in dev mode?

Unanswered
Cane Corso posted this in #help-forum
Open in Discord
Cane CorsoOP
Hey, I'm sure many of you guys have experienced nextjs in dev mode is extremely slow, any idea on how to fix that or if they are working on it yet?

111 Replies

Siamese Crocodile
Hey, yea it's really slow, I do know that the Next team is working on improving it
@Siamese Crocodile Hey, yea it's really slow, I do know that the Next team is working on improving it
Kawakawa
:This:

However, @Cane Corso I do believe they addressed it slightly in a recent next update?
So try do pnpm update or yarn update or npm update (whatever package manager you use) and see if that makes a change
Cane CorsoOP
Well I guess it's not 15-20 seconds now, but still 4-5 for a simple route
i use yarn
but its already updated
Kawakawa
Try deleting your node modules folder, as well as the .next folder
And then re-install modules and try re-running dev.
You might have a messed up cache :shrug:
Cane CorsoOP
but what would that accomplish?
okay, I can try I guess
nah still bad
i think it has to do with the amount of module change
Kawakawa
Hm
Cane CorsoOP
that is quite a lot
Kawakawa
Screenshot your app dir for me
And put it here
(expand all folders)
Cane CorsoOP
gimme a sec
here
Kawakawa
What's in your middleware file? Don't have to show me, just tell me what's going on in there
Cane CorsoOP
its basically just checking if u are logged in and then redirecting you to the dasboard
and visa versa
if you are not logged in you cannot get to the other routes, but get redirected to login
but thats about it
Kawakawa
Gotcha, standard stuff then.
Cane CorsoOP
i mean i can show u
Kawakawa
No it's fine
Cane CorsoOP
not much
okay well nvm xd
Kawakawa
Yeah I have something similar haha
Right well, are you fetching any data in layout files asynchronously?
Cane CorsoOP
nope
Kawakawa
Hm
Do you have any template files?
Cane CorsoOP
well inside of layout I have components that fetch asyncronously
Oh yeah that's fine as long as the pages themselves aren't dependent on the data
Cane CorsoOP
oh yea then nvm
Kawakawa
Hm
You got any other files other than components or page files that are fetching data?
Cane CorsoOP
hmm im using a ui library
called shadcnd
or sth like that
Kawakawa
So am I in my current proj 😂
Cane CorsoOP
and that made me install
radix stuff
damnnx
xdddd
Kawakawa
Well for starters, you have Yup and Zod?
Cane CorsoOP
and nope I dont have anything else xd
Kawakawa
Both do the same thing
(runtime type validators)
Cane CorsoOP
yea ik, some ui element made me isntall
zod
xddd
Kawakawa
Yep
Well
Ok well that shouldn't cause this though still
Cane CorsoOP
yea i thought so too, but agree that 1 would be sufficient
@Cane Corso yea i thought so too, but agree that 1 would be sufficient
Kawakawa
Definitely, but we are trying to fix your issue - not clean your code (unless we have to 😂)
Cane CorsoOP
yea xdddd
Kawakawa
So what pages are taking the longest to comp?
Cane CorsoOP
uhmmm well any of them if next didnt cache them, for example if i wait around a minute or so
but most of those havent had anything in them yet
thats why its so weird
Kawakawa
So what have you actually done other than the default next install?
Cane CorsoOP
1 literally had a text in it and it loaded for 2-3sec
@Cane Corso 1 literally had a text in it and it loaded for 2-3sec
Kawakawa
Then it's not the page, it must be either a layout or a middleware or something like that iykwim.
Cane CorsoOP
wym, what are we looking for
hmmmmm
Kawakawa
I mean hold on let me test my app times
Cane CorsoOP
okayyy
i mean idk how this slows anything down
Kawakawa
Ok maybe it is a Next thing 😂
Cane CorsoOP
xDDD
yeaa i think so too
if i build it its super fast
but on dev mode its so bad
Kawakawa
I mean to be fair though, just think of it as an issue for now in the dev environment
Think of it like a "cold start" issue
Cane CorsoOP
yea ig ur right, it just irritates me xdd
i saw some posts about modularizedImports
Kawakawa
Same, but hey - what can you do 😂
Cane CorsoOP
but that didnt help either xd
@Kawakawa Same, but hey - what can you do 😂
Cane CorsoOP
go back to pages dir
that didnt have this issue
😭
@Cane Corso go back to pages dir
Kawakawa
I mean the pros outweigh the cons however for the app dir
At least, in my use-case
Cane CorsoOP
yea ik, for me too its just idk when it is going to be fixed
or if they are working on it yet
do u know by chance?
Kawakawa
No clue, I'm just an average Joe like you :kek:
Well, look out for updates and maybe stuff can get fixed a tad
But I think it's also down to RSC stuff...
Cane CorsoOP
I actuallly hacked NASA last week but yes
Kawakawa
But again, can't do much about it
Cane CorsoOP
oh wait who said that
@Cane Corso I actuallly hacked NASA last week but yes
Kawakawa
Ahh true 😂
@Kawakawa But again, can't do much about it
Cane CorsoOP
yea gotcha
well thanks anyways
Kawakawa
Alright, well have a nice day
Yeah 👍
Cane CorsoOP
you too bud