When I try to use lodash function as a specific import as shown below then it shows to be it loads only 14.7KB in size.

But when I try to use the import as a destructured object then it shows 69.6KB in size

Some articles say it works the same for both the above imports while some say it doesn't. Just wanted to understand does it add the complete build or only a specific function in the final build, especially the 2nd syntax (destructuring)
$ npm i -D babel-plugin-lodash
.babelrc
{
...,
"plugins": [..., "lodash"]
}
This will allow for any import style (e.g. import _ from 'lodash', import { isEqual } from 'lodash' as the plugin will transform each usage of a lodash func to:
import xyz from 'lodash/xyz';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With