DEV Community

Discussion on: How to write a tree-shakable component library

squgeim profile image
Shreya Dahal

I have been trying to build a react component library that exports ESM. I tried your config and it does work when I run the next app in dev mode next dev, but when I try to build it in production mode next build, it fails. It gives me the Invalid hook call error (even if I don't use hooks in the library).

Any idea what's happening?