Opinions along this line show a clear disconnect between those who use React only vs. those who don’t use React at all.
It’s easy to assume what makes sense for you makes sense for everyone because who cares about those who don’t use the same framework as mine?
But - Vite is framework agnostic, vendor agnostic, and we can’t go down that slippery slope. What if tomorrow we are going to add another 5mb for a Rust Vue compiler, and next week another for Svelte, Solid, and Astro? One can argue React is the most popular so it deserves special treatment, but where should that line be drawn? Why NOT other frameworks?
Vite is downloaded 12 millions a week, every uncached download consumes bandwidth and CI time. 5mb might not mean much for an individual end user, but it can result in meaningful difference at scale. If there is a way to optimize it, we should try that. It’s ironic that people complain about node_modules size while at the same time dismissing size optimization efforts.
Not worth a withdrawal IMO, better to just take the lump and refine. Disk space is an odd thing to optimize for given it's a dev dep and storage is plentiful and cheap
I’ll answer this in good faith because I know you are not stupid. I’m the first one to admit there is no clear line here. Always case by case. Cost of JSX is much lower. Typescript usage % is much higher and more indispensable than React. ESbuild shipped these already so we need feature parity.
To answer a common question - why not make React Compiler a plugin?
It all comes down to practical trade-offs. Making it a rust-based plugin is already significantly faster than the Babel version (up to 15x), but still 50% slower than direct-in-oxc due to the data passing / AST cloning overhead for being a plugin.
This is also different from e.g. Vue or Svelte where there are completely different AST formats; the React Compiler works on a JS/JSX AST that Oxc already supports (with only slight format differences). By integrating it in Oxc we can eliminate a lot of the AST cloning / transforming overhead, which isn't feasible for other frameworks. It'd be a shame to leave such a big perf opportunity on the table.
We are also fully aware of how integrating it will result in bigger binary size for users who don't use React Compiler, which is why I personally blocked the version that resulted in a ~5mb increase. We are aiming to get it down to a reasonable level while optimizing binary size across the board to minimize the downside.
For the long run, we are aiming to make raw AST transfer (which is already used in oxlint JS plugins) applicable to transform plugins. This would allow us to ship oxc plugins without AST cloning perf overhead.
We withdrew the Rust React Compiler integration from Rolldown and Vite because it increased the binary size from 28.7MB to 33.8MB, a 17% increase, which cannot be justified for all Vite users.
My current experiment is to have Claude understand our constraints.
Preliminary results show up to a 2x performance improvement with only a 1.4MB increase in binary size.
Next step is to de-slopify and get the code into a maintainable state, and also upstream some of the changes.
🚀 Vite 8.1 is out
⚡ Experimental Full Bundle Mode: ~15x faster dev server startup & ~10x faster full reloads on large apps
🧩 Chunk Import Map to keep chunks stable & improve caching
🦀 WASM ESM integration
💡 Lightning CSS on the road to default
👀 and more!
Blog post below.
Time to unmask the man behind this work!
@Shanshrew has created a novel parser architecture which is 2x - 3x faster.
Pleased to announce that we're collaborating to integrate it into Oxc.
The speed-up is real, and massive!