Why formik is dependent on lodash and lodash-es? Shouldn't it utilize only one of the dependencies?
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).
Most helpful comment
It not only depends on both, it apparently simply does not use -es version.