Back to all fixes
CuratedTypeScriptVite 8local
output.topLevelVar defaults to true and breaks dead-code elimination in Vite 8
Problem
Setting `build.rolldownOptions.output.topLevelVar: false` in Vite 8 has no effect - classes/const declarations still compile to `var`, defeating dead-code elimination and bloating the production bundle vs Vite 7. Docs state the option is disabled by default, but behavior didn't match.
Solution
typescript
Fixed upstream in Oxc v0.137.0 / Rolldown v1.1.2, included in Vite v8.1.0. Upgrade to vite@8.1.0 or later; the `topLevelVar: false` config then takes effect and DCE works correctly on `var` declarations too. No workaround needed at or above 8.1.0.