Closed jirikrepl closed 2 years ago
If possible I think it would be better to examine usage and replace with functionally equivalent internal code.
I'm all for replacing external dependencies, but more along @copleykj comment.
I'd say this is a no go. Meteor is on its way to remove underscore as many of the utilities offered by underscore can be swapped with native implementations. And in our case of Collection2 we're only importing the functions we need and not the whole lodash package. So, we're not necessarily bloating up Collection2. Relying on underscore is a bad investment and not future proof given the climate.
What'd I be interested in is replacing those lodash utilities with native functions. If you can open up a PR about that I'll gladly accept it.
https://github.com/meteor/meteor-feature-requests/issues/48#issuecomment-634533727 https://github.com/meteor/meteor/pull/11531 https://github.com/meteor/meteor/pull/11495 https://github.com/meteor/blaze/pull/331
I see that collection2 has some dependencies on lodash. collection2.js uses lodash only in a few places. I saw that those lodash calls should be compatible with underscore
I could create a PR with something similar to this commit: https://github.com/jirikrepl/meteor-collection2/commit/3f2046bf6ffdc3b02b899bc6fd89131beaf1af7f
In my app, many other packages depend on underscore. I think that meteor packages use underscore more.
Lodash in collection2 adds another 6Kb into the bundle.
What do you think? @harryadel @StorytellerCZ