Just confirming, server actions files are not included on client?
Answered
Polish posted this in #help-forum
PolishOP
Hello, server actions are imported in Client Components in order to be referenced and called.
I could not find we’re is explicitly specified that NextJS will not include this function implementation on the Client Component even when it is imported there.
I assume the are not included on the final Client Component but can someone point me where is this explicitly specified? Thanks
I could not find we’re is explicitly specified that NextJS will not include this function implementation on the Client Component even when it is imported there.
I assume the are not included on the final Client Component but can someone point me where is this explicitly specified? Thanks
Answered by joulev
The implementation is not included in the client bundle don’t worry
7 Replies
@Polish Hello, server actions are imported in Client Components in order to be referenced and called.
I could not find we’re is explicitly specified that NextJS will not include this function implementation on the Client Component even when it is imported there.
I assume the are not included on the final Client Component but can someone point me where is this explicitly specified? Thanks
The implementation is not included in the client bundle don’t worry
Answer
Only the server address of the server action is included in the client bundle
So your secrets are safe
PolishOP
It will be helpful a note from NextJS on that on their page 😬
Thanks
Shy Albatross
"use server" is a React feature, not a Next.js feature, it's like you'd want Next.js docs to explain Array.prototype.reduce because it can be used in Next.js app.
https://react.dev/reference/react/use-server
https://react.dev/reference/react/use-server