-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Trans.tsx to 'use client' #1899
Conversation
This only works in client components anyway. Why not add 'use client' here so that it doesn't blow up when composed in server components?
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Thank you for this! We should also add |
So the thing is, NexJS team doesn't provide library authors with a clear guideline how to incorporate this "use client" in the usual library building pipeline. The problem is, code of the library transpiled and bundled into one file, so this "use client" will not appear at the top of the module, and will not work as you are expecting. |
Yes this a thing... bundler support for |
Well, it seems the "proposed way" is to just turn the whole bundle into "use client". Since we have a separate entrypoint for |
Closed in favor of #1902 |
This only works in client components anyway. Why not add 'use client' here so that it doesn't blow up when composed in server components?
Description
//: # The Trans component as is cannot be used directly in Server Components. If we make a wrapper for it, then it ruins extraction for the instances that use the wrapper. I believe this would solve that issue. It appears that the eventual solution for an RSC version would involve an alternate version of the component that is swapped in via a compile time plugin, so we may as well go with the fact that this specific component will be exlcusive to the client side, and mark it as such (
'use client'
) so that it integrates with RSCs better.Types of changes
Fixes # (issue)
Checklist