-
Notifications
You must be signed in to change notification settings - Fork 388
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
[Bug?]: Client bundle including imports from "use server" functions #1526
Comments
So I have narrowed it down to if I use |
Reproduction: https://stackblitz.com/edit/github-fk8exj-eru4op?file=src%2Fapp.tsx
|
tldr; use dynamic imports so that build tools can analyze and tree-shake correctly |
@mdynnl on top of that, if a package/module has side-effects, the bundler can potentially fail to remove the unused import. |
We have changed the server-function tree-shaking heuristics with the new plugin. |
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
The text was updated successfully, but these errors were encountered: