Formik: Why formik is dependent on lodash and lodash-es?

Created on 3 Feb 2020  路  5Comments  路  Source: formium/formik

鉂換uestion

Why formik is dependent on lodash and lodash-es? Shouldn't it utilize only one of the dependencies?

Most helpful comment

It not only depends on both, it apparently simply does not use -es version.

All 5 comments

It not only depends on both, it apparently simply does not use -es version.

It's surely better to fix it in Formik, but in the meantime we can use a Webpack alias to drop "lodash-es" from the bundle: https://github.com/GoogleChromeLabs/webpack-libs-optimizations#alias-lodash-es-to-lodash

There is nothing to fix in formik. lodash-es is used by esm bundle. You better to alias commonjs version because webpack wraps each commonjs module with function. So you end with bigger bundle size.
https://unpkg.com/browse/[email protected]/dist/formik.esm.js

The recommendation is wrong.

Maybe it would be better to use a single dependency in a way described here.

Single dependency is used. But different for node and for bundler. All packages should follow same (or just avoid using lodash).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

najisawas picture najisawas  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments

giulioambrogi picture giulioambrogi  路  3Comments

Jucesr picture Jucesr  路  3Comments

PeerHartmann picture PeerHartmann  路  3Comments