You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, we currently require two peer deps, redux 2.6kB and react-redux 5.5kB brining the total footprint of ReSift to around ~22kB (given that you're not already using react + react-redux).
Here is the result of running webpack-bundle-analyzer (without redux or react-redux):
My biggest takeaways:
superagent (http client) eats up too much of the budget. Bundlephobia says it's 6.2kB. If we remove that and replace it with a simpler XHR equivalent, we'll reduce the bundle by nearly 50%. Note that we can't replace Superagent with window.fetch because ReSift needs the ability to cancel the request.
useStatus on our side is relatively large and can be reduced in size easily
If we do those, we can shave off 7-8kB off the bundle taking the ReSift core bundle (without Redux) to be around 6.4kB and with Redux, around 14.5kB.
I think these items are a good first iteration goal of reducing bundle size. There will be more investigation of removing redux and react-redux for the purposes of concurrent mode in #32 but for now, I don't think removing redux is worth focusing on for a stable release.
how we bundle
we currently bundle using webpack with the library option of UMD. My current understand is that this way of bundling does not support tree-shaking (though in reality, you'll probably end up using all of ReSift so tree shaking is somewhat irrelevant).
I know other libraries like react-router use rollup. I'd like to switch as well. In general, we just need a bundling audit.
The text was updated successfully, but these errors were encountered:
I've been playing around with rollup and I have to say it's significantly better for bundling. It produces much cleaner outputs and supports ESM bundles which are tree-shakable. I'll definitely bundle v0.2.0 with rollup
This issue is to track to two things:
bundle size
The bundle size in ReSift is not great, I think it's acceptable but we could do better.
According to bundlephobia, ReSift is 13.9kB minified and zipped.
However, we currently require two peer deps, redux 2.6kB and react-redux 5.5kB brining the total footprint of ReSift to around ~22kB (given that you're not already using react + react-redux).
Here is the result of running webpack-bundle-analyzer (without redux or react-redux):
My biggest takeaways:
window.fetch
because ReSift needs the ability to cancel the request.useStatus
on our side is relatively large and can be reduced in size easilyIf we do those, we can shave off 7-8kB off the bundle taking the ReSift core bundle (without Redux) to be around 6.4kB and with Redux, around 14.5kB.
I think these items are a good first iteration goal of reducing bundle size. There will be more investigation of removing redux and react-redux for the purposes of concurrent mode in #32 but for now, I don't think removing redux is worth focusing on for a stable release.
how we bundle
we currently bundle using webpack with the library option of UMD. My current understand is that this way of bundling does not support tree-shaking (though in reality, you'll probably end up using all of ReSift so tree shaking is somewhat irrelevant).
I know other libraries like react-router use rollup. I'd like to switch as well. In general, we just need a bundling audit.
The text was updated successfully, but these errors were encountered: