Hi! It seems like the fp variety of lodash isn't supported in the lodash-es package. Is this intentional?
I'm using CRA and would like to reduce my bundle size through tree shaking. I've read through this thread https://github.com/facebookincubator/create-react-app/issues/1069 and it seems like the CRA's lodash babel plugin implementation is waiting for lodash v5. Is there still a way to benefit from tree shaking using lodash/fp and something like lodash-es?
Hi @mvanlonden!
Tree-shaking is a bit of a lie. Tooling tends to be overly sensitive to potential side-effects, of which Lodash has none. I recommend using babel-plugin-lodash (it works for lodash/fp too) and if you're feeling adventurous combo it with lodash-webpack-plugin with the "currying" feature set enabled.
Update:
Webpack 4 will support the sideEffects field which will allow for better tree-shaking support.
Most helpful comment
Hi @mvanlonden!
Tree-shaking is a bit of a lie. Tooling tends to be overly sensitive to potential side-effects, of which Lodash has none. I recommend using babel-plugin-lodash (it works for
lodash/fptoo) and if you're feeling adventurous combo it with lodash-webpack-plugin with the"currying"feature set enabled.Update:
Webpack 4 will support the
sideEffectsfield which will allow for better tree-shaking support.