Next.js Discord

Discord Forum

high compile times for every page

Answered
Alligator mississippiensis posted this in #help-forum
Open in Discord
Avatar
Alligator mississippiensisOP
whenever i click on a link to move to a new page, it takes 4-5 seconds for the new page to load.
im not sure what "relevant bit of code" or my implementation i shud show because i think im missing something very basic.
Image
Answered by B33fb0n3
then the promises takes "that long" to resolve. You can create a loading.tsx to instantly show an UI to improve the UX. This loading.tsx will be visible when the page is loading. After the loading is done the actual page (page.tsx) will be visible.

Another solution would be to "resolve" those promises faster. However: I don't know how much control you have over that part of infrastructure
View full answer

20 Replies

Avatar
@B33fb0n3 try to use the turbo flag when developing (next dev --turbo)
Avatar
Alligator mississippiensisOP
i get the same issue on production tho
Avatar
@Alligator mississippiensis i get the same issue on production tho
Avatar
no it won't. Inside production your pages are already compiled. Also: you can't use turbo inside production
Avatar
@B33fb0n3 no it won't. Inside production your pages are already compiled. Also: you can't use turbo inside production
Avatar
Alligator mississippiensisOP
nono i meant
i have the same issue of high compile times for my app in production.
i read about using the turbo flag online but realised it would only reduce time during development.
why app on production has the same high compile time issue
Avatar
Alligator mississippiensisOP
i think it is vercel
one of my teammates hosts the app
Avatar
ah ok. When you are in production (using next build && next start) then every single page is already compiled. So there must be a compile time of 0 seconds
Avatar
@Alligator mississippiensis nono i meant i have the same issue of high compile times for my app in production. i read about using the turbo flag online but realised it would only reduce time during development. why app on production has the same high compile time issue
Avatar
Alligator mississippiensisOP
maybe im using the term "compile time" incorrectly here? maybe load time is the right word?
when i click on a link, it takes 4-5 seconds for a new page to load
Avatar
it takes 4-5 seconds for a new page to load
are there any promises on this "new" page?
Avatar
Alligator mississippiensisOP
yes
Avatar
@Alligator mississippiensis yea im using the wrong terminology then
Avatar
ah ok, thanks for clarifing that 👍
Avatar
@B33fb0n3 ah ok, thanks for clarifing that 👍
Avatar
Alligator mississippiensisOP
yep mb
Avatar
@Alligator mississippiensis yes
Avatar
then the promises takes "that long" to resolve. You can create a loading.tsx to instantly show an UI to improve the UX. This loading.tsx will be visible when the page is loading. After the loading is done the actual page (page.tsx) will be visible.

Another solution would be to "resolve" those promises faster. However: I don't know how much control you have over that part of infrastructure
Answer
Avatar
happy to help