Skip to content
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

Use individual lodash functions #864

Merged
merged 2 commits into from
Jun 7, 2016
Merged

Use individual lodash functions #864

merged 2 commits into from
Jun 7, 2016

Conversation

sotojuan
Copy link

May help with #862.

I replaced lodash with individual packages for each function. This brought down the size by ~4mb. Not too bad!

@coveralls
Copy link

coveralls commented May 13, 2016

Coverage Status

Coverage remained the same at 98.83% when pulling 469a8b9 on sotojuan:smaller-lodash into e65ad72 on cheeriojs:master.

@solomon-gumball
Copy link

👍 Another consequence of this change is that lodash no longer pollutes the global namespace. I am actually using the react testing library 'enzyme' and it's dependency on 'cheerio' is frustrating for that reason (currently overriding underscore)

Would like to see this change merged! :)

@sotojuan
Copy link
Author

Ping @fb55 @jugglinmike :-)

@fb55
Copy link
Member

fb55 commented May 24, 2016

IMHO keeping the _ variable and creating an object inside each file would be a bit more readable.

@sotojuan
Copy link
Author

sotojuan commented May 26, 2016

Hm, I can see how that would be ideal. I don't mind doing that—what does @jugglinmike think?

@sotojuan
Copy link
Author

sotojuan commented Jun 7, 2016

Sorry for the late PR—been busy. I think I did what you meant, let me know.

@coveralls
Copy link

coveralls commented Jun 7, 2016

Coverage Status

Coverage remained the same at 98.83% when pulling 5020288 on sotojuan:smaller-lodash into e65ad72 on cheeriojs:master.

@fb55 fb55 merged commit e7d18af into cheeriojs:master Jun 7, 2016
@fb55
Copy link
Member

fb55 commented Jun 7, 2016

Awesome, thanks a lot :)

@ianstormtaylor
Copy link

It seems like this change should be done using the lodash/bind syntax that 4.0 supports (which will cause an even greater reduction in size when using cheerio with other dependencies) instead of the lodash.bind syntax which requires pegging a module for each function.

@sotojuan
Copy link
Author

@ianstormtaylor if @fb55 agrees I don't mind submitting a PR for that. So it'd just be installing lodash fully again but using var bind = require('lodash/bind')? I'll have to test it later! Thanks.

@ianstormtaylor
Copy link

@sotojuan yup, exactly like that! It should mean that other deps using lodash will also share the deps, even if they require the whole module.

@sotojuan
Copy link
Author

👍 We'll see what the repo owners think and I'll implement as needed.

@billyjanitsch
Copy link
Contributor

@sotojuan @ianstormtaylor I implemented the change you suggested in #913.

@mxro mxro mentioned this pull request Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants