Skip to content

vite 8.0.13 breaks const enums used as types when casting #22452

@ogdakke

Description

@ogdakke

Describe the bug

Const enums used as types in casting disappear from the bundled output in Vite 8.0.13, whereas in Vite 8.0.12 they were still present as regular compiled enums.

not reproduced in rolldown repl directly

Reproduction

https://stackblitz.com/edit/vitejs-vite-kh3ktnpe?file=src%2Fmain.ts

Steps to reproduce

run npm i and npm run dev

System Info

System:
    OS: macOS 26.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 94.25 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.8.0 - /Users/danielwargh/.nvm/versions/node/v24.8.0/bin/node
    npm: 11.6.0 - /Users/danielwargh/.nvm/versions/node/v24.8.0/bin/npm
    bun: 1.3.14 - /opt/homebrew/bin/bun
    Deno: 2.6.5 - /Users/danielwargh/.deno/bin/deno
  npmPackages:
    @vitejs/plugin-basic-ssl: ^2.3.0 => 2.3.0
    @vitejs/plugin-react: ^6.0.1 => 6.0.1
    vite: 8.0.13 => 8.0.13

Used Package Manager

bun

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitehas workaroundp2-edge-caseBug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new release

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions