React: React Distribution

Created on 16 Nov 2016  路  1Comment  路  Source: facebook/react

React is an amazing library, literally changed the way I get to develop applications at my job and made a more pleasant experience day to day. However I absolutely hate how so many legacy things affect react. The way react is built is terrible and from issues I've seen it seems to be some "legacy build system" monstrosity that could never be fixed because of internal Facebook reliance on these things. A major part of the community suffers from this in more than one way:

  1. React is extremely large despite react clones like Preact and Inferno (the most popular alternatives)
  2. React distributed size is well large in comparison to vue and angular
  3. React Cannot be compiled through Googles Closure Compiler

A start to this change could be switching to more modern build system like Webpack and Rollup create smaller library output (Particularly Rollup) and smaller bundles for people who use React in their web applications

As much as people would love to contribute to change the way react is built someone not familiar to how react current build system is tightly coupled with Facebooks usage will not be able to get a PR successfully merged. I'm hoping that with the rewrite and release of React Fiber this can be fixed and with the new found Performance movement going on in the Javascript community The team at Facebook behind react will accept this call to action and make a change for the better and for all those reliant on react. If not, well, were shit out of luck.

Most helpful comment

Can you please back up the claim that React size is large compared to Angular? I'm curious about these stats (not saying it's not true, just the first time I heard this). Are you comparing minified size of production version? Before or after gzip?

We are well aware of React being larger of libraries like Preact. They are also different in feature sets (for example React supports fully controlled inputs, batching across subtrees, normalization of events, and some other features that we found useful after using it in production for several years on large products). Different React-inspired projects pick different sets of tradeoffs and we think this is fine.

We won't be spending effort optimizing the build size until Fiber is ready. We do think Fiber will be easier to optimize for that, but this will be a later step. Unlike smaller libraries we don't have the luxury of throwing away legacy APIs every month. We move slowly so that big products can move together with us. This means some innovations and deprecations will lag behind leaner libraries but it also ensures a healthy ecosystem that can smoothly move on as a whole.

I'll close this because it's not a specific or actionable issue. You will find issues and pull requests for all the specific points you mentioned. There are reasons some of them aren't moving forward, and we'll address them after Fiber work is done.

Cheers!

>All comments

Can you please back up the claim that React size is large compared to Angular? I'm curious about these stats (not saying it's not true, just the first time I heard this). Are you comparing minified size of production version? Before or after gzip?

We are well aware of React being larger of libraries like Preact. They are also different in feature sets (for example React supports fully controlled inputs, batching across subtrees, normalization of events, and some other features that we found useful after using it in production for several years on large products). Different React-inspired projects pick different sets of tradeoffs and we think this is fine.

We won't be spending effort optimizing the build size until Fiber is ready. We do think Fiber will be easier to optimize for that, but this will be a later step. Unlike smaller libraries we don't have the luxury of throwing away legacy APIs every month. We move slowly so that big products can move together with us. This means some innovations and deprecations will lag behind leaner libraries but it also ensures a healthy ecosystem that can smoothly move on as a whole.

I'll close this because it's not a specific or actionable issue. You will find issues and pull requests for all the specific points you mentioned. There are reasons some of them aren't moving forward, and we'll address them after Fiber work is done.

Cheers!

Was this page helpful?
0 / 5 - 0 ratings