lodash-es and lodash/fp

Created on 6 Jul 2017  路  1Comment  路  Source: lodash/lodash

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?

question

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/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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aj0strow picture aj0strow  路  3Comments

dengyaolong picture dengyaolong  路  3Comments

bryandowning picture bryandowning  路  3Comments

thoraage picture thoraage  路  3Comments

ryyppy picture ryyppy  路  3Comments