[Turbopack] Dead-code elimination drops code after a `switch`, Server Action returns `undefined` in production
SWCTurbopack
### Link to the code that reproduces this issue
https://github.com/albert4719/turbopack-deadcode-repro
### To Reproduce
1. npm install
2. npm run build
3. grep the compiled action chunk in .next/server/chunks/ssr — the code after the switch is gone
### Current vs. Expected behavior
A server action with a switch (one empty `case` + break, and `default` returning the same value as another case) loses all code after the switch in `next build`. It returns undefined for the empty case. Works fine in `next dev`. Details +
de-minified output in the repo README.
### Provide environment information
```bash
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 65179
Available CPU cores: 32
Binaries:
Node: 26.2.0
npm: 11.13.0
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
next: 16.2.9 // Latest available version is detected (16.2.9).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: N/A
Next.js Config:
output: N/A
```
### Which area(s) are affected? (Select all that apply)
Turbopack
### Which stage(s) are affected? (Select all that apply)
Other (Deployed), next start (local)
### Additional context
_No response_
关闭于 2026-07-07 1 条评论