Vite 8 (rolldown) emits incorrect code for string const enum with alias members. The same code works correctly with Vite 7 (esbuild).
export const enum Theme {
Light = "Light",
Dark = "Dark",
Default = Theme.Light,
}
console.log(Theme.Light); // Vite 7: "Light" ✓ | Vite 8: "Default" ✗
Rolldown emits a numeric-style reverse mapping (e[e.Default = e.Light] = "Default") that overwrites the forward mapping. TypeScript never generates reverse mappings for string enums.
Repro: https://github.com/elderapo/vite8-const-enum-bug
npm install && npm run build && node dist/main.js
Upstream: rolldown/rolldown#8866
Vite 8 (rolldown) emits incorrect code for string
const enumwith alias members. The same code works correctly with Vite 7 (esbuild).Rolldown emits a numeric-style reverse mapping (
e[e.Default = e.Light] = "Default") that overwrites the forward mapping. TypeScript never generates reverse mappings for string enums.Repro: https://github.com/elderapo/vite8-const-enum-bug
Upstream: rolldown/rolldown#8866