Skip to content

Import client components from a dependency #1303

Answered by frandiox
dominikgilg asked this question in Help
Discussion options

You must be logged in to vote

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:

  • Export *.client.js components from your library.
  • Upgrade to Hydrogen 0.20.0 (the way client components are discovered changes in this version).
  • Pass 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!

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@frandiox
Comment options

@dominikgilg
Comment options

@frandiox
Comment options

@dominikgilg
Comment options

@frandiox
Comment options

Answer selected by dominikgilg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants