-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Nuxt extremely slow on initial request #20596
Comments
I guess 2 minutes for really large projects on low performance machines is nothing unreasonable? Depends a lot on your exact setup and project so you might want to provide a reproduction project + specs if you feel like you're running into a bug of sorts. |
Would you provide a reproduction? 🙏 |
Assuming I had a low-performance machine, sure. I guess the question is WHY is it doing this? I took a look at the PR, I don't think the watcher is the issue. I've also tried disabling SSR, no improvement. Just what on earth is Nuxt doing on that initial request? |
A slower first request is typically due to vite performing on-demand transpilation of the assets needed to render a page. (This can be client-side, not just SSR.) But 2-3 minutes is not expected behaviour. Which is one reason why I asked for a reproduction. |
@danielroe yeah fair enough. I don't see it on native vue apps, using vite, so not sure. I'll setup a repro. |
Having the same issue, after building to our test env the first initial load is like SUPER slow.... |
@glennovische Could you open a new issue with a reproduction? This issue is about dev server initial request performance. |
@glennovische This issue in particular is for dev env slow initial requests. Things like vites initial transpilation don't apply to a built app. I'd probably recommend you open a new issue for built apps alongside a reproduction😊 damn daniel beat me to it :D |
I just started experiencing this after pulling up a Nuxt3 version rc12 or something in a new " supposedly better" pc. I have now updated all dependencies but pnpm run dev takes minutes to run. Why could this be happening? to fix this issue I have restarted several times, deleted and reinstalled with node_modules no fix yet. My project is almost empty and I am still troubleshooting. Will start a fresh nuxt project and see if I have the same problem. Current output: Vite warmed up in : 32235ms 🙆♂️ |
Oh. Wow. Brand new nuxt project
This is unexpected. My Environment
|
If you are hitting this on Windows it's a pretty painful regression from 3.5.1. You can set The fact that you were experiencing this problem on an old project suggests that there is an issue in a dependency which has caused the regression. |
Oh Wow. That was it. 😅 |
Happening on mac as well. |
how and where to set these settings @danielroe ? |
In nuxt.config.ts like this
|
can confirm this fixes my slow start problem
|
+1 |
After I add this config to repo url: Atinux/content-wind/demo Operating System: Win10
export default defineNuxtConfig({
extends: 'content-wind',
experimental: {
watcher: "chokidar",
},
}) |
Where do you define that? I set it up in the nuxt.config.ts as: experimental: {
watcher: 'chokidar'
}, And I still see 132 seconds to warm up nuxt server. |
@kirkbushell Nuxt v3.5.2 should no longer have the regression I described above (so no need to modify your config). There is an open PR that should resolve the original issue here but if you can provide a reproduction I can confirm that. |
Is any update on this issue ? Just wait 3 minute for nitro built :( |
@adiramardiani Would you open a new issue with a reproduction? 🙏 This is really not okay and we want to resolve it for you. |
It is likely that in windows something is being wrongly bundling in dev mode. Reproduction would greatly help to resolve relevant issues 🙏 |
I have a similar issue, in dev mode, the app loads , but it takes another minute or so in the browser to load color mode switcher in the header and for Pinia to become available, meanwhile, some components are available on the page but not interactive I suspect it has to do with anything ClientOnly or Pinia in a project, even if the project is a simple page with a simple layout it is frustrating I hope the issue is analyzed , In build mode it does not have this problem |
@khalidzamer We can investigate if you are able to provide a reproduction. |
@danielroe , my hero, while I was establishing a new repo that I can share publicly, I tried adding the same packages and configs gradually.. I might have discovered what is causing the issue on my side, I so far suspect the issue is using
I tried it in my original working app and the reload time difference is massive and the pain is gone! Speaking of |
@khalidzamer Can you check |
@pi0 yes Pooya , that's when I noticed the change in default behavior and suspected something is wrong, although I had this slow behavior last week in previous version, thank you for your efforts |
Just wondering ... Any chance the issue with using "localhost" on windows will get addressed? It will take some time for our development team to get used to using 127.0.0.1 for our nuxt apps. |
@stevenhurth That's true. At that very moment, I had been drafting unjs/listhen#126. So sorry for all the frustrations on this matter. As a security measure, we had to limit the default host and it introduced unforeseen edge cases. |
No worries at all! Thank you for jumping on it! |
any update?. WARN Slow module @nuxt/devtools took 55013.7ms to setup. |
I confirm that indeed using 127.0.0.1 instead of localhost has a significant impact: 😁 127.0.0.1chrome_KR2dvXWubI.mp4😴 localhostchrome_Xmzq1DRzQ0.mp4 |
Switching from localhost to 127.0.0.1 did the trick for me. |
Experiencing the same issue of slow build / laggy hot-reload:
The fix for me was to use |
this is still an issue - does Nuxt 3 not support 'localhost'? |
this is a real problem i run this on my machine
taking almost 1 minutes to run the first request, can not move any further with this, with my laptop 2 minutes as well , even i am on my first steps on the project, |
Im too having this problem. App takes about 30-40 sec to load, nitro 40sec. Any HMR is dead for now. Any change in text or style takes about 10-15 sec to load. Changing from localhost to IP does not help :/. Anyony have other solution? |
Same here. ℹ Vite client warmed up in 27239ms And the page is barely loading at all. I'm only using these plugins
and it's just a really small blog that once was pretty fast in it's current state with the same dependencies. |
@mklueh It looks like you're using 3.8.1 which was meant to seriously improve this. Would you see if you can open a minimal reproduction or share access with me? |
I manage to solve this issue. For me it was primevue combined with tailwind - unistall them too make HMR runs again, also vite reduced from 30-40 sec to 10. In my opinion it was some collision between styles (my css files, tailwind and primevue styles). First I tried removing all <style> tags from every file in my App and i helped to reduce time by half, but waiting 5-6sec to see any changes its still anoying. I hope this helps someone. |
I just noticed the DOM inspector panel in firefox developer console is related to this. Other panels works fine, but the if the DOM inspector is open it's a nightmare |
Very nice, it worked for me |
The same issue still persists with Nuxt 3.8.1. On localhost, the requests to fetch all imports take ages and sometimes even result in a few reloads when Vite finds a new dependency. When serving the app via 127.0.0.1 it's much, much faster. |
Identical issue for me on 3.8.1 localhost is painfully slow, while 127.0.0.1 works fine. Does anyone have a clue why? Environment is setup via WSL on Windows. |
Same on mac, 127.0.0.1 is at least better (not by much). I'm using the server directory and it takes ages to load, specially on localhost. Nuxt version 3.8.2 |
The same for me. Using Nuxt 3.8.2. |
I was having a similar issue, warmup + nitro build were taking forever. Turns out for me the problem was I had a some large directories in the folder (was trying out .direnv on nix + I had electron building to a non-standard dir .output-electron). After ignoring them times went down from 1 minute or more to just 5 seconds. |
How did you implement the ignore? Starting my dev server takes ages. And Nuxt-ui is always being reported as a slow module. |
@tobychidi Sorry I didn't clarify. You can use .nuxtignore or the ignore option in the config is the same thing. Am using nuxt now for more complicated projects and putting everything in the root then scanning nearly everything by default is not a good default imo. Personally I've switched to putting everything in src (using the srcDir option) to avoid any further issues. You can then do the following in the nuxt ignore:
|
Environment
Reproduction
Start a nuxt project, run npm run dev and then open the site in the browser, now go make a coffee.
Describe the bug
After running: npm run dev, and opening the site in the browser, that initial request takes 2-3 minutes. After that, refreshes are instant.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: