Replies: 8 comments 27 replies
-
Available using: https://vitejs.dev/config/#optimizedeps-include |
Beta Was this translation helpful? Give feedback.
-
We already have 1600 files and it's getting a pain to worth with the project. Build time is extremely fast, yet loading in the browser is very slow. We might even pass 3K files based on our expansion plans. We would also welcome this feature very much. |
Beta Was this translation helpful? Give feedback.
-
I want to chime in that we are facing the same problem. On dev the initial page load fetches ~3.6K files... This is an insane amount. |
Beta Was this translation helpful? Give feedback.
-
Anyone make any progress on this or have idea how to improve it? This is a huge pain point for devs of large projects. |
Beta Was this translation helpful? Give feedback.
-
I really can't understand why vite can't check every file from its cache at startup to see if it's still valid, and send them all in a single payload in dev mode regardless of if they're going to be used. Cost would be pretty minimal. Then vite runtime in browser would use the cache instead of a request first if possible until first cache invalidation. what https://github.com/antfu/vite-plugin-prebundle does feels so logical; hope it would be finished/working in more cases. What is the hidden reason this is not yet the default; it kinda baffles me compared to how popular / widespread it is. I know it's probably an overly optimistic estimation, but it really feels like a 2 day poc from one core vite contributor IMO. (not really a rant, but a personal comment I feel may be useful to hear): Vite is awesome, I love it... BUT: the sad part is that every year, I look for a solution to this very issue, and come to the same sad conclusion that vite is either not that "smart" or not properly maintained. And people around me too now have the mentality of "let's just wait for some better tool". Slow desillusion for such a cool project. If anyone want to attempt to fix that user-land, I guess it is probably doable with some web worker local to your projects, intercepting requests, returning some local cached version "synchronously", while still sending the request to check if things changed to invalidate things. may be tricky, but feels worth trying at this point. and thanks for the cool project anyway :) |
Beta Was this translation helpful? Give feedback.
-
Is there any estimate time of release for Rolldown (+ vite integration of rolldown)? |
Beta Was this translation helpful? Give feedback.
-
I'm surprised nobody has added this suggestion yet but if you haven't already enabled SSL on your local dev server then you should: https://v4.vitejs.dev/config/server-options.html#server-https This will significantly improve throughput of the module loading because HTTP2 needs SSL to work and HTTP1 has a limit of I think 4 concurrent downloads at a time (with a much larger connection overhead). Try enabling SSL and see if that improves the situation any 👍 |
Beta Was this translation helpful? Give feedback.
-
I wanted to come back to this topic because we have been doing massive improvement recently on our code base. The local experience was bad because we needed to load so many file at initial boot. But that also meant that our main bundle was massive even in production for our customers. We started using more dynamic imports to split our app into multiple chunks that loads only when needed (mostly tied to pages) |
Beta Was this translation helpful? Give feedback.
-
Currently, vite doesn't perform well with large projects with a lot of modules (1000+) on
dev
mode. The bottleneck is on the browser side:The bundled app is less than 50KB but it requires a lot of dependencies (I'll provide a sample repo soon). So currently vitejs cannot be used for large or very fine grained applications 😢
We could probably fix it by bundling and caching on the fly some of the modules. It's not an simple task, but this could help a lot to scale vitejs.
Other ideas or solutions ?
Beta Was this translation helpful? Give feedback.
All reactions