casesandberg / react-color

:art: Color Pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
http://casesandberg.github.io/react-color/
MIT License
12.05k stars 922 forks source link

Why lodash and lodash-es #822

Open alexander-schranz opened 3 years ago

alexander-schranz commented 3 years ago

This is more a question, I did see that this package install in my application lodash and lodash-es. Is here both required?

jjb commented 3 years ago

https://github.com/casesandberg/react-color/pull/749

alexander-schranz commented 3 years ago

Would it be possible to define lodash and lodash-es as peerDependency so only one of them is installed in my project, which I define? See #829

bmakan commented 1 year ago

How do we get rid of non-es lodash? Right now, they are both installed when I install react-color and they both end up in my bundle.

react-color is the only package using the non-es lodash I have right now.

bmakan commented 1 year ago

I managed to get rid of lodash by adding an alias to my vite.config.ts:

...
resolve: {
    alias: {
        lodash: 'lodash-es',
    },
},
...

Fairly sure something similar can be done for webpack and other bundlers.

This is a wider issue supposedly being addressed by the lodash maintainers: https://github.com/lodash/lodash/issues/5107.