the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

Bundle size #43

Closed eXaminator closed 5 years ago

eXaminator commented 5 years ago

Hi,

great library, but the bundle footprint seems to be rather large. In fact, in my small app it's the second largest after react-dom, even larger than redux itself.

webpack-bundle-analyzer gives me the following non-gzipped values: react-dom: 103.89KB redux: 6.04KB deox: 40.09KB

I saw issue #42 which was just resolved. Maybe this will fix this issue too, but in general I'm not sure if maybe this library could be optimised some more. Maybe even add better support for tree-shaking. Sadly I'm not an expert on that topic myself.

the-dr-lazy commented 5 years ago

Hi @eXaminator

Deox internally supports tree-shaking. In the build system of Deox, we create an ESM bundle of Deox that is tree-shakeable. The problem is the browser field in the package.json. Webpack prefers browser field over module and thus follow non-tree-shakeable UMD bundle instead tree-shakable ESM bundle.

the-dr-lazy commented 5 years ago

To solve the problem we should rename browser field to unpkg.

the-dr-lazy commented 5 years ago

Screen Shot 2019-04-05 at 10 50 33 PM