-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Vite build is terribly slow when there are more than 1000 files. #10132
Comments
If this function is taking much time, I think there isn't anything Vite could do because this function is in rollup. Would you create an issue in rollup? |
Sure, thx for pointing to a right direction |
Closing as it was fixed in rollup 2.79.1 |
@sapphi-red can you share some info when it should land in Vite? |
I'm not sure but I think it would land in 3.2. For now, you could use |
Describe the bug
As described in a discussion topic I'm trying to move from Parcel to Vite on a Design System project. This project has over 2600 icons, that are small react components. They are included via an export file that is a
Map
with all those icons as [name: string, importer: async import].It worked fairly well with Parcel, both dev and build are quick enough to make people not complain.
With Vite dev process is also pretty quick, but build is totally unacceptable. In an original project I let it run and it finished after 46 minutes.
I made a repro repo, there, Parcel finishes in 25 seconds, while Vite is already reaching minutes (it's 1825 files so I assume it's going to be around 30 minutes).
My current educated guess is that there's a problem with how Vite or actually rollup builds the dependency tree. It seems like every single dependency is matched against every other file in the tree. Which make the process run with O(n^2) performance, which with 2600 files makes it all run for over 40 minutes.
For now I have no clue how to debug it further, I might sit on this problem later though.
Reproduction
https://github.com/sznowicki/repro-repo-dynamic-imports
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: