Open ian-pascoe opened 3 weeks ago
So I have narrowed it down to if I use "verbatimModuleSyntax": true
that is causing the problem. As soon as I change it to false, my project builds with "use server" imports not being shipped to the client
Reproduction: https://stackblitz.com/edit/github-fk8exj-eru4op?file=src%2Fapp.tsx
verbatimModuleSyntax
as explained by esbuild tells esbuild to not drop unused import statements, which is probably causing the server-only imports to not be removed from the client build.
I don't think rollup respects
Happens in build too, nevermindverbatimModuleSyntax
so this seems to just be a dev-only problem.
Duplicates
Latest version
Current behavior 😯
Vinxi and Vite are bundling dependencies that are only used in
"use server";
functions. For example:Vite throws this error during client bundle:
Here is my app.config.ts:
Workaround
I can get it to bundle successfully by moving the server function to a separate file and put
"use server";
at the top.Expected behavior 🤔
"use server";
dependencies should only be included in ssr and server bundlesSteps to reproduce 🕹
Steps:
Context 🔦
This is completely blocking my project. I cannot have all my server code sectioned off with my desired design.
Your environment 🌎
No response