import merge from `lodash/merge`
merge(options, overrides)
There's also the ES6 build which you can use better with a bundling system that supports tree shaking.Not much to gain though. Just importing lodash works fine.
There's not many good alternative (there's a lot of alternative, but none that are as comprehensive), essentially has ONE person really working on it (and threatening to stop imminently), and the code is unreadable, so hopping into it once said maintainer goes poof will be tricky.
We still depend on it (no great alternative), but it's a ticking time bomb IMO.
You might be better off bundling lodash and tree shaking everything you don't actually use away.
But that's just more waiting, and you still end up downloading the ENTIRE script (unless you get REALLY fancy with webpack in a way I don't even want to think about...)
I have a friend who has done, in production, exactly what your subconscious is afraid of. I should get him to do a write up sometime: it's both amazing and horrifying at the same time...
I've thought about it a bit before, and always ignored it because there'd be no real benefit.
But i could see writing a crazy webpack config that breaks out all my lodash functions into their own bundle, then tries to add a script tag to the CDN version, doing some quick processing to determine if it's in the cache, and if it's not falling back to including my own custom-built script tag (and canceling the request to the CDN version).
I'm sure it wouldn't provide any benefit to anyone, but it would be a fun code-golf exercise!
Only if each site is using the exact same version of Lodash which is unlikely. Lodash is tiny anyways.
You'll need something like https://github.com/lodash/babel-plugin-lodash.
Full build (~22 kB gzipped)
Especially for those with empty cache (need to make 1 extra DNS request, download 1 extra file, which is mostly unneeded, etc).