Introduced Vite into our React project but it's still an experimental development option due to some rough edges.
Our project has thousands of SCSS and source files(nearly 10k).
The motivating factors were 5-12 minute startup times for CRA depending on the power of the developers workstations, and equally burdensome builds requiring now over 8GB of Node heap to complete without hitting OOM events.
Really, really convinced this style of tooling is the future however here are some issues we are running into:
* 4s full page refreshes
Much slower that when Webpack finally gets going. If I'm working on something that may require lots full-page loads I'll opt for CRA.
This is in part to do with the sheer number of source files. Part AFAIK they aren't using a strategy such as a Merkel tree to keep track of which import chains are actually invalid and instead re-request every file every reload.
Part is SCSS which is a super, major PITA performance wise on a project of this size. Vite doesn't yet support embedded SCSS, and embedded SCSS doesn't support process reuse so it may not even work well with this dev server strategy.
* HMR objects
Editing certain(mostly non-component) code will cause duplicate class names to be created: MyClass2, MyClass3, and etc. Vite seems to use a different strategy than Webpack which, I believe, use proxy objects.. In any case these can cause "instance of" and other failures that trip people up and send them on wild bug chases.
* Weird optimization requirements
In your project's src importing from folder index files is considered harmful to Vite performance.
When importing from node_modules NOT IMPORTING from the base index is considered harmful to performance!? It will not optimize deep import deps automatically(pre-bundle and browser cache them).
=========
Even though I'm convinced this is the direction of dev tooling I'm not sure Vite will be the winner here. I can't help but feel entire server should be written in a language such as Go, and a better incremental build and delivery strategy needs to be in place. A strategy so that the browser only needs to request the files that have changed while going to cache directly for everything else. Otherwise very large projects will continue to be problematic.
Yeah, lazy loading components but that's not always desirable particularly in single page "apps".