I see that importing the entire lodash library takes up quite a bit of space on disk:
$ du . | grep lodash
1696 ./lodash/fp
5000 ./lodash
In my code I am just doing
require('lodash');
and my package.json just looks like:
"dependencies": {
...
"lodash": "^4.6.1",
...
}
Note that this is for a backend project only, not for web, if that makes a difference.
So my question is - what is the latest way of just importing a slice of lodash (just the functions I need) without importing the whole damn thing?
It looks like here are some answers:
https://gist.github.com/callumlocke/bbfc524eaed6b3556dab
My guess is that I should be using the dot syntax for my backend project:
"dependencies": {
...
"lodash.X": "^4.6.1",
...
}
and then import it like so:
require('lodash.X');