Challenges with Supporting Server Components Due to Bundling Configuration #88
Labels
🐛 bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
I've encountered some difficulties in fully supporting server components in this library because of an issue with the current bundling configuration. Presently, all code is bundled into a single file, which causes conflicts when certain components or functions need to be loaded as server components. Since some components rely on client-side features like
useState
orContext
, the entire package ends up requiring the'use client'
directive, even for parts that don’t need it.To address this, I've started bundling each component separately. and use barrel index file to gather all components, applying the
'use client'
directive only for the components need it. This change should help resolve the issues related to bundling everything into one file while ensuring proper support for server components.Below is the configuration for the previous version of Tsup, which bundles the entire library into a single large file. While it functions correctly, it poses limitations in supporting server components:
Here is the new Tsup configuration I'm testing:
However, this version is causing an issue:
Task :
If anyone has suggestions for fixing this issue or would like to help, your contributions would be greatly appreciated!
The text was updated successfully, but these errors were encountered: