3 ms·
It is possible to tree-shake Lodash. If that's not practical in this case, Lodash also ships individual function packages (for example: https://www.npmjs.com/pa
by city41 6y ago
It is possible to tree-shake Lodash. If that's not practical in this case, Lodash also ships individual function packages (for example: https://www.npmjs.com/package/lodash.isequal https://www.npmjs.com/package/lodash.isequal), as an alternative to tree shaking.
- flanbiscuit 6y agoLodash has deprecated these individual packages and they will be removed in v5: https://lodash.com/per-method-packages https://lodash.com/per-method-packages They recommend adding the main `lodash` package and then importing only the functions you need. import throttle from 'lodash/throttle`; I prefer using the `lodash-es` package for the reasons outlined in these 2 blog posts https://til.hashrocket.com/posts/dnzttruljf-prefer-lodash-es-when-using-webpack https://til.hashrocket.com/posts/dnzttruljf-prefer-lodash-es... https://itnext.io/lodash-es-vs-individual-lodash-utilities-size-comparison-676f14b07568 https://itnext.io/lodash-es-vs-individual-lodash-utilities-s...