Skip to content

Proposal decorators initializers not called if class contains an abstract field #895

@SCLeoX

Description

@SCLeoX

Related plugins

Describe the bug

If a class contains an abstract field, the initializers added by es proposal decorators (the stage 3 one, not experimental decorators) are not getting called.

I have already reported the bug to babel as it is also possible to trigger with babel alone. However, it might be caused by misconfiguration. See here for more info: babel/babel#17541 (comment)

Reproduction

https://github.com/SCLeoX/vite-proposal-decorator-reproduction/blob/main/src/reproduction.ts

Steps to reproduce

Run npm install and then npm run dev. Open webpage and open dev tools. See the initializer is not called. Commenting out the marked line causing the initializer to work normally.

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 94.92 GB / 127.90 GB
  Binaries:
    Node: 23.5.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.10 - C:\Users\SCucu\.bun\bin\bun.EXE
    Deno: 2.3.5 - C:\Users\SCucu\.deno\bin\deno.EXE
  Browsers:
    Chrome: 140.0.7339.208
    Edge: Chromium (140.0.3485.54)
    Firefox: 143.0.4 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.19041.5794
  npmPackages:
    @vitejs/plugin-react: ^5.0.4 => 5.0.4
    vite: ^7.1.7 => 7.1.9

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions