Unable to package PandaCSS components in standalone component library #1212
Closed
willTastyMakers
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
I have created a repo delineating an example design-system library package and a web-apps consumer. Perhaps, someone can shed some light on the issue above ^^^^^ |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks,
My team has been building a standalone component library ( not used in a mono repo, but imported in variety of different apps). While we can package the components in our library without errors, we have issues consuming the packaged library into our nextjs web apps.
Questions:
Shouldn't the compiled build files ( index.js and index.mjs) in /dist file contain the 'use client' directive above each component listing in these files? ( A search of these files in my build shows that this directive is not present. When I look at the resulting build files in other libraries, such as the nextui's library I do see the 'use client' directive present.
If and when we get the first question sorted, do we need to created separate packages for the components in the library that utilize the "next client" directive and those that don't? ex.
( I have noticed that even when we try to import a file from the library
@tms/design-system
that does not include the client directive a runtime error occurs pointing to component in the index.mjs file the does contain the 'use client' directive. )We are following the Panda Docs
Guide for Component Library /Use Panda as external package , trying both of the processes listed.
Neither of the two methods above create a viable solution. Both processes result in errors within the consuming nextjs app.
an issue of components using state ( useState) that do not recognize that it should only be used on the client as it include the "use client" directive.
Even when we import components from the library that do not include state, we find the app failing in the browser because of these other components that are included in the library and are not perceiving the inclusion their "use client" directive.
Beta Was this translation helpful? Give feedback.
All reactions