web-infra-dev / rsbuild

The Rspack-based build tool. It's fast, out-of-the-box and extensible.
https://rsbuild.dev/
MIT License
1.86k stars 144 forks source link

[Bug]: swc wrongly compiles ts decorator when developing #3973

Closed s-elo closed 1 week ago

s-elo commented 1 week ago

Version

System:
    OS: macOS 13.6
    CPU: (10) arm64 Apple M1 Pro
    Memory: 160.67 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Brave Browser: 128.1.69.162
    Chrome: 130.0.6723.119
    Safari: 16.6
  npmPackages:
    @rsbuild/core: ^1.0.19 => 1.1.1 
    @rsbuild/plugin-vue2: ^1.0.1 => 1.0.2

Details

vue2-ts.zip looks like swc provides the ts decorator parameters wrongly for property decorator

snippet of @Prop decorator in vue-class-component: Image

swc helper snippet: Image

Reproduce link

https://github.com/user-attachments/files/17745924/vue2-ts.zip

Reproduce Steps

pnpm i pnpm dev

9aoy commented 1 week ago

You should set decorators.version: 'legacy' to get support for property decorators. https://rsbuild.dev/config/source/decorators#legacy

s-elo commented 1 week ago

You should set decorators.version: 'legacy' to get support for property decorators. https://rsbuild.dev/config/source/decorators#legacy

oh I see, thx a lot master~