- Notifications
You must be signed in to change notification settings - Fork142
Get rid of lodash to achieve a smaller file size#22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
JaKXz commentedJan 24, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@bkonkle thanks for the contribution - I think in the time that this PR was made and now the lodash file sizes have improved, and I just tested v1.1.0 and found it to be < 10k [uncompressed and not uglified] including Improvements like this are welcome though, so if you find something else, feel free to crack open another PR! :) |
dmytro-shchurov commentedJan 24, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It's very sad it is closed, because it's a pain to use redux-promise -> flux-standard-actions with SystemJS. Because when I agreed to configure lodash.isplainobject, it required yet more 4 modules: _basefor, isarguments, isarray, keysin. My config.js is getting bigger and bigger, and soon exceeds a size of lodash |
@JaKXz instead of replacing Before importisPlainObjectfrom'lodash.isplainobject';importisStringfrom'lodash.isstring';importisSymbolfrom'lodash.issymbol'; After importisPlainObjectfrom'lodash/isPlainObject';importisStringfrom'lodash/isString';importisSymbolfrom'lodash/isSymbol'; Thus, for those users who's also using |
One benefit of this approach is user can combine withbabel-plugin-lodash and thus preventing importing the whole |
Hey@tomchentw I think that's a reasonable suggestion, want to make a PR? :) I have a broader, naive question though, probably for@jdalton: Would it be possible to have |
jdalton commentedFeb 7, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@JaKXz! The In the case of this PR though simply upgrading |
JaKXz commentedFeb 7, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@jdalton thanks for the reply :) I believe we were at but yeah that's a good idea, I'll take a look at redux. |
jdalton commentedFeb 7, 2017
If you go the redux route you can combo withlodash-webpack-plugin for an even smaller bundle. |
I've created the PR#51 to address it. |
When creating a browser bundle for my unirouter library, I noticed that redux-actions was pulling in nearly 10k from Lodash. I traced it to flux-standard-action, and the isPlainObject call. To eliminate 10k from flux-standard-action's file size, I wrote a standalone isPlainObject function.
This is mostly extracted from Lodash 4, as are the tests. I didn't include the IE6/7 host object check, but that's easy to add in if you'd like. Let me know what you think!