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 lodash per-method packages #7

Closed
wants to merge 1 commit into from

Conversation

Zirro
Copy link

@Zirro Zirro commented Sep 25, 2017

The complete lodash package weighs in at about 5.1 MB, making it a very large production dependency. By using lodash's per-method packages instead, you can reduce the size of many node_modules folders out there.

I replaced ._isArray with Array.isArray() as the former has been deprecated in favour of the latter.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9496ab4 on Zirro:lodash-packages into 77e4f18 on request:master.

3 similar comments
@coveralls
Copy link

coveralls commented Sep 25, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 9496ab4 on Zirro:lodash-packages into 77e4f18 on request:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9496ab4 on Zirro:lodash-packages into 77e4f18 on request:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9496ab4 on Zirro:lodash-packages into 77e4f18 on request:master.

@analog-nico
Copy link
Member

Thanks a lot @Zirro !

Quick question: Is it safe to replace _.isArray() with Array.isArray() in old environments like node.js v0.10?

@Zirro
Copy link
Author

Zirro commented Sep 27, 2017

Yes, that should be okay. Array.isArray() was specified in ES5, so it’s been supported for quite a while. Even lodash uses it in their code :-)

@2PacIsAlive
Copy link

hey all, currently fighting to shave down the size of a node.js docker image and this would help a bit.. any update on this PR?

@CorWatts
Copy link

CorWatts commented Dec 6, 2018

What's the latest on this? Could we please get this merged in?

@joshuawinsor
Copy link

What is the hold up on merging this? Why was #14 merged instead of this one?

@realityking
Copy link

realityking commented Feb 20, 2019

Note that lodash intends to not support the per-method packages in lodash v5 https://github.com/lodash/lodash/wiki/Roadmap

@2PacIsAlive
Copy link

hey just checking in on this, based on the latest info from @realityking are you still planning on merging this in?

@analog-nico
Copy link
Member

If you are using a package bundler like Webpack then you will be able to reduce the code size even more than if this library would use the per method packages. Splitting the lodash packages apart actually required some code duplicates. Those don’t exist in the main lodash library. Thus the main lodash plus using a package bundler is the way to go. I hope that works for you!

@odinho
Copy link

odinho commented Feb 17, 2020

That doesn't really work no.

I'm trying to reduce the size of our build artifacts we have for a few node servers. We don't want to run webpack on the servers for many reasons. But doing it because a dependency of a dependency chooses to drag in the whole of lodash is a bit weird. This is the only package still having a full lodash import.

@mastermatt
Copy link

Just a note that Lodash discourages the use of the per method packages and is planing on removing them in the next major.
https://lodash.com/per-method-packages

@odinho
Copy link

odinho commented Feb 17, 2020

Yeah sure. The best thing is to stop using lodash for super basic stuff as this project is doing :)

Indeed at work we've removed all of lodash, with our own small specialized helpers for stuff like debounce etc that does what's needed. Most other stuff we've just rewritten to regular js.

Now with optional chaining obj?.prop there won't be any need to use a helper for nice "get"-ing even :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.