BerkeleyTrue / react-redux-epic

37 stars 13 forks source link

Reduce module weight #22

Closed Bouncey closed 6 years ago

Bouncey commented 6 years ago

This module is SUPER heavy!

react-redux-epic Even doing a direct import with import { wrapRootEpic } from 'react-redux-epic/lib/wrap-root-epic'; has a size 208.5K (39.6K gziped)

Consider using webpack or rollup and specifying externals of rxjs and redux-observable so they are not included in this module. I think it would be sae to assume that anyone using this module already has those deps

Bouncey commented 6 years ago

For compasion:

react is 44K (13.7K gziped) rxjs is 199.1K (36K gziped)

BerkeleyTrue commented 6 years ago

Hey @Bouncey,

I apologize for the lack of documentation.

wrapRootEpic isn't really required clientside.

There is react-redux-epic/client that will let you import the client side version of wrapRootEpic as well as the render method. This version of wrapRootEpic is just an identity function.

https://github.com/BerkeleyTrue/react-redux-epic/blob/master/client.js

Here are the docs for the client side stuff https://github.com/BerkeleyTrue/react-redux-epic/blob/master/docs/api/README.md#usage-2

But it is clearly missing the wrapRootEpic method.

It also doesn't mention that these client-side methods are completely optional and are there for symmetry more than anything.

Server side we import the whole Rxjs library to avoid some issues I ran into writing this library.

Let me know if this reduces your bundle size.