Loadsh lazy evaluation, how to introduce the method in webpack

when packaging loadsh in webpack, in order to keep the packaged file as small as possible, you can introduce specific methods
such as

separately.
var chunk = require("lodash/array/chunk");

only the code related to the chunk method will be introduced here, which ensures that the packaged code only uses the code used

but loadsh has a good feature of lazy evaluation, which can optimize execution performance
use something like this

_(arr).map().filter().take().value()

if you want to use lazy evaluation, it is necessary to introduce loadsh, as a whole so that the packaged file will be very large
I wonder if there is any way to minimize the number of packaged files and support lazy evaluation

Mar.21,2021

introduces the chain method, which has the same effect and can also be introduced on demand.

_.chain(arr).map().filter().take().value()
Menu