tomchentw / react-toastr

React.js toastr component
https://tomchentw.github.io/react-toastr/
MIT License
619 stars 112 forks source link

lodash usage #81

Closed dannief closed 8 years ago

dannief commented 8 years ago

Hi,

In your file ToasterContainer.js, you are importing lodash like thisimport _ from "lodash", but you seem to only be using the omit function. This causes webpack bundles requiring react-toastr to be unnecessarily large. lodash.js is about ~500kb. You can just require the function directly e.g. import _omit from "lodash/omit". This will greatly reduce the bundle size.

I am pointing this out because I am using react-bootstrap-table, which depends on react-toastr and noticed that even though I am only using 2 lodash functions, webpack was pulling in the entire library. I was able to trace it back to react-toastr.

Thanks.

tomchentw commented 8 years ago

My bad. I thought I had babel-plugin-lodash enabled in my .babelrc. I'll do a quick fix! Thanks

tomchentw commented 8 years ago

Released v2.8.2