-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Next 13 apps directory 'use client' directive is used on all exports of a library #15830
Comments
@merijnhofsteenge there is an issue with how Next.js is detecting server vs client components. One workaround for now is to do deep imports from a client component to another client component. For example, if you update
Then inside import { ClientHello } from "@nx-next-13-use-client/mixed-lib/src/lib/ClientHello";
// ... This will build properly since the |
I think the problem is here: https://github.com/vercel/next.js/blob/2820f0787512b6514e36c02cbddd4d3ab69f0251/packages/next-swc/crates/core/src/react_server_components.rs#L64 It looks like since the server component is being exported from The workaround is as I highlighted above with deep imports, or to keep server and client libraries separate. |
Unfortunately, there isn't much we can do from our end since this is the the logic in We might make |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Since nx 15.8.7 it is possible to use the 'use client' directive on nx libraries. It seems however that when an import is made from a library, all the other components exported from the same library get explicitly checked for whether they are client or server components. Some examples of this behaviour:
Expected Behavior
GitHub Repo
https://github.com/merijnhofsteenge/nx-next-13-use-client
Steps to Reproduce
Follow the readme of the repo
Nx Report
Failure Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: