Skip to content

[Bug]: String const enum with alias member produces incorrect reverse mapping #9312

@sapphi-red

Description

@sapphi-red

Reproduction link or steps

https://stackblitz.com/edit/github-6a5oovrc-jgcvqbfz?file=src%2Fmain.js,package.json

What is expected?

The output to be:

var Theme = /* @__PURE__ */ function(Theme) {
        Theme["Light"] = "Light";
        Theme["Dark"] = "Dark";
        Theme[Theme["Default"] = Theme.Light] = "Light";
        return Theme;
}(Theme || {});
console.log(Theme.Light);
console.log(Theme.Default);

What is actually happening?

The output to be:

var Theme = /* @__PURE__ */ function(Theme) {
        Theme["Light"] = "Light";
        Theme["Dark"] = "Dark";
        Theme[Theme["Default"] = Theme.Light] = "Default";
        return Theme;
}(Theme || {});
console.log(Theme.Light);
console.log(Theme.Default);

System Info

Stackblitz

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 22.22.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown: 1.0.0-rc.18 => 1.0.0-rc.18

Any additional comments?

maybe related to #9235
Originally reported at vitejs/vite#21996

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions