-
Notifications
You must be signed in to change notification settings - Fork 142
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of lodash to achieve a smaller file size #22
Conversation
@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! :) |
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 import isPlainObject from 'lodash.isplainobject';
import isString from 'lodash.isstring';
import isSymbol from 'lodash.issymbol'; After import isPlainObject from 'lodash/isPlainObject';
import isString from 'lodash/isString';
import isSymbol from 'lodash/isSymbol'; Thus, for those users who's also using |
One benefit of this approach is user can combine with babel-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 |
Hi @JaKXz! The In the case of this PR though simply upgrading |
@jdalton thanks for the reply :) I believe we were at but yeah that's a good idea, I'll take a look at redux. |
If you go the redux route you can combo with lodash-webpack-plugin for an even smaller bundle. |
I've created the PR #51 to address it. |
* chore(package): add "babel-plugin-lodash" to devDependencies * feat(package): add "lodash" to dependencies * feat(index): switch to lodash modules under different entry points * Ref #22 * feat(package): remove "lodash.isplainobject", "lodash.isstring", "lodash.issymbol" from dependencies * Ref #22
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!