Import client components from a dependency #1303
-
Hi all! I'm currently working on a component library which can be used as a dependency for Hydrogen apps.
When I move the same component inside the /src folder of the Hydrogen app, it works fine. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Client components from external dependencies are a topic that is currently being discussed in the React Server Components RFC. The way you author client components might need to change soon. That said, you can try the following as of today:
That should instruct Vite and Hydrogen to look into your library and find client components there. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Client components from external dependencies are a topic that is currently being discussed in the React Server Components RFC. The way you author client components might need to change soon.
That said, you can try the following as of today:
*.client.js
components from your library.ssr.noExternal: [/your-lib-name/]
to Vite.That should instruct Vite and Hydrogen to look into your library and find client components there.
Hope that helps!