Closed javlund closed 2 years ago
Hey javlund, we are adding this to a wish list of work we want to tackle in the future. Thanks for bringing awareness to the large library size.
@noritheduck Do you have a scheduled schedule? Instead of such a vague time in the future, because the size of the library has reached about 250kb
, which is several times that of the jotai
Library of the same type.
@usercao Yeah, I ended up going with jotai as well for this reason. Would be nice if Recoil got smaller though.
There are some things recently which increased the development package size, such as using flow-copy-source
which copies the source files completely to provide the Flow type definitions. But, that shouldn't affect the minimized production bundle size. It would be interesting to see the breakdown of the production bundle, how much is due to the HAMT dependency, etc. Looks like bundlephobia.com is currently offline. If the above picture says it is currently 22.9k and HAMT is 15k, then finding a lighter-weight alternative sounds like an interesting place to start. Help investigating and optimizing this is definitely appreciated!
Any updates on this?
Recoil has been steadily growing, and is now about 3,5x larger than v0.0.7:
While it's not a huge lib, it's still one of the biggest in my build - and one that has to be loaded up front, as the whole app needs to be wrapped in
<RecoilRoot>
:Again, it's not gigantic by any means, but it does affect the sizes of the main chunk - to the point where next.js actually starts marking pages depending on it as red instead of green:
Looking at issues like https://github.com/facebookexperimental/Recoil/issues/959, I see that I'm not the only one having noticed this. I'm wondering, is work being done to make it more treeshakable perhaps? Or a "light" version like Preact is to React? I'm only using the most basic functionality (
RecoilRoot
,atom
,useRecoilState
etc.) so if it was possible to trim the build a bit it would be very much appreciated.