Closed krazyjakee closed 3 years ago
Thank you @krazyjakee for your PR. I do not know a lot about lodash-es. But just found the following benchmark info here:
Another option you can use is lodash-es: the Lodash library exported as ES modules. Some of us might say that this is a preferred option. (...) The result is that the build size is much bigger with lodash-es. So, I don’t see any reason to use it.
Not sure if that is still true. The article was written in Mar 21 2018. Do you have any references?
The benchmark is based on a compilation without tree-shaking. With tree-shaking, lodash-es will only bundle the code that is actually used for the library (in this case minBy
and remove
).
BUT
It's not the fault of this library but frankly, I'm so disgusted with the amount of undocumented configuration involved in actually getting tree-shaking to work with ts-loader or babel and webpack that I am throwing my hands in the air and giving up. I can't give you the references you need because I can't seem to actually get it working properly as it should.
I'll close this for now.
Anyway, thanks for this great library!
Alright. I decided to import only the separate functions at least for now. I guess that does not change the bundle size, but looks better I guess :-)
Why?
When bundling this for browsers using webpack, the entire lodash library is bundled. By using lodash-es, only the specific functions are bundled. This allows tree-shaking to work and makes the library a better es-module.