Ability to distinguish between the client and server component in turbopack loader #86557
AleksandrSl
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Be able to tell inside the loader that the code you're transforming is a client component. Currently client component goes through both
condition: { not: "browser" }andcondition: "browser", while server components go throughcondition: { not: "browser" }as expected.The problem is that
serverpart of the client component (Client Component SSR) still cannot use any of the server side APIs, but from the loader perspective there is no way to know thatNon-Goals
No response
Background
We are working on a library that modifies the code of the application for translation purposes and we need to inject different thing into the client and server components. So being able to tell client component from server is crucial
I saw this issue - #63150 - about conditions, but as I described in the goal client components fall under both "server" and "client" ones
Proposal
Since there is no metadata being passed to the loader, maybe there could be another condition? Something like "server-only" that will apply the loader only to the components that do not have the SSR part.
Beta Was this translation helpful? Give feedback.
All reactions