Svelte's is about 2.1KB last I checked. Can React get below 40KB?
Svelte's is about 2.1KB last I checked. Can React get below 40KB?
The package size I linked is specifically the `react-dom.production.min.js` bundle that is used on the client side. The `react-dom` package does include _separate_ bundles used for server rendering, but that whole React client bundle will get included in your app, and it does _not_ tree-shake at all.
(To be clear I _like_ React, but it's best to be accurate about what happens here.)
There's 3 different flavors of `react-dom` for use in the client (dev, prod, profiling), and then several variations of `react-dom` for use _on the server_.
The client bundles don't include any of the server functionality.
_None_ of the bundles are treeshakeable at all, because A) they're shipped as CommonJS modules and not ESM, and B) the way the React library is written and architectured as a whole. All of the reconciler logic is intertwined and unshakeable, so even if React did suddenly switch to shipping ESM modules instead of CJS, it would still end up as the exact same bundle size.
Just created a fresh Vite+React app and rendered a "hello world" component, and the resulting output is:
dist/assets/index-uoOveHrm.js 142.66 kB │ gzip: 45.76 kBSure, I'd lose access to the React ecosystem, but I'd also gain access to the vast ecosystem of vanilla JS libraries without having to write/use a wrapper, so that's a wash. (bind:this is awesome!)