markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 101 forks source link

feat: adding esm build #104

Closed Niputi closed 2 years ago

Niputi commented 2 years ago

closes: https://github.com/markusenglund/react-switch/issues/100

have tested this change in a vite project under dev and production and it seems to be working.

fyi: your typescript definitions are not currently defined in the package json I didn't add it in this commit as I'm not sure how it should be handled for users since it depends on react types

markusenglund commented 2 years ago

Hey, I tried it and it on webpack project as well and it seemed to correctly pick prod/dev bundle and so on. Good job, I wasn't aware that conditional export was possible with ESM.

Does it matter that type definitions aren't in package.json? The types are working fine in my environment.