4 ms·
I just went looking for a minimal react install and found this: https://github.com/krasimir/react-bare-minimum https://github.com/krasimir/react-bare-minimum
by yebyen 8y ago
I just went looking for a minimal react install and found this:
https://github.com/krasimir/react-bare-minimum https://github.com/krasimir/react-bare-minimum
When I was able to get it working, it came out to 880kb. That's more than (nearly) 600kb! I thought you were exaggerating.
The stimulus umd.js by comparison is 60kb uncompressed.
- tomnipotent 8y agoReactDom is the actual culprit. Preact [1] is a great ~4kb alternative, though it's still on the v15 API. React makes sense for something like Facebook/Instagram web where users interact with the app hundreds of times in a single session, but we can't fall into the trap of treating it like jQuery and hitting every nail we come across with it. I'm hopeful that like jQuery, whatever features that make ReactDom et al. so large will eventually make their way upstream and be codified as browser specs. [1] https://github.com/developit/preact https://github.com/developit/preact
- yebyen 8y agoI've heard of preact! Thanks for reminding me of this
- WorldMaker 8y agoThat "bare minimum" repo is including a lot of Babel polyfills. You could use Typescript instead of Babel, and shave off a bunch of polyfills in the process. Comparing apples more to apples, while the react-dom.development.js is indeed ~600 kbs. The minified production build of react-dom is only ~70 kbs [1], which is is smaller than jQuery minified (but not gzipped) [2]. It's not necessarily React itself that is bloating these project sizes. [1] https://github.com/facebook/react/releases https://github.com/facebook/react/releases [2] https://mathiasbynens.be/demo/jquery-size https://mathiasbynens.be/demo/jquery-size