[Design System] How to expose components built with preset? #728
-
Currently I'm following the Design-System Guide, everything works fine. Now, I want to create a Button component and reuse it, how can I do it? my-monorepo
├─ apps
│ ├─ web <-- where I use the `Button` from `packages/button` ❌ Error
│ └─ docs <-- where I directly use the `preset` from the `packages/preset` ✅ Good
├─ packages
│ ├─ preset <-- where I expose the `preset` using `definePreset`
│ └─ button <-- where I import the `preset`, define component and export it The error relates to the import path of the emitted package. Can you provide document for how to achieve this? Because I think most people would go this way rather than directly consume the I'm using: pnpm workspace, next.js, typescript, turbo, tsup, all latest version. UpdatedUsing I only get the error when trying to build the UpdatedUsing
Therefore I think this would cause problem if I try to publish this package to a registry. I think I have to also bundle the UpdatedAssuming I have:
I think I have to bundle the generated css for each version of button. Is it correct? Or there is other better way? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@tunguyen-ct I don't fully understand your question, but if you want a jsx version of your button recipe, then use this and this An online reproduction or a sample repo, could help me better understand your project structure too. |
Beta Was this translation helpful? Give feedback.
-
@anubra266 I heard @astahmer talked about the |
Beta Was this translation helpful? Give feedback.
-
hey, the answers from discord were:
here's an actual example of a panda monorepo usage with a consuming app and multiple ui-lib providers |
Beta Was this translation helpful? Give feedback.
hey, the answers from discord were:
here's an actual example of a panda monorepo usage with a consuming app and multiple ui-lib providers
https://github.com/astahmer/panda-monorepo