Replies: 1 comment
-
|
This is a known gap in the Vite 8 transition. The Oxc transformer (which replaced esbuild) does not support lowering TC39 Stage 3 (native/ECMA) decorators. Legacy TypeScript decorators ( Current upstream status
In short: native decorator lowering is not coming to Oxc/Rolldown imminently. WorkaroundsThe Vite 8 migration guide documents two plugin-based workarounds. Option 1: Babel (recommended for
|
| Approach | Decorator version | Performance impact | Status |
|---|---|---|---|
| Wait for Oxc native support | n/a | None | No timeline (oxc#9170) |
@rolldown/plugin-babel |
2023-11 |
Low (filtered) | Working now |
| SWC plugin | 2022-03 |
Low (filtered) | Working now, older spec revision |
| Rewrite to legacy TS decorators | n/a | None | Works natively, requires code changes |
The Babel plugin approach is likely your best path forward: it supports the 2023-11 spec version, the performance overhead is minimal with the @ filter, and it requires zero changes to your decorator usage.
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In our organization we're using stage 3 decorators quite a lot: in some internal libraries, but also with this open source library. Our main rationale is to move towards ECMAScript standards instead of keeping legacy TypeScript decorators "alive".
This worked fine with Vite 7:
However, with Vite 8 we now have a big problem: since it's dropping
esbuildin favor of Rolldown (with oxc), we're gettingNow our whole tool chain breaks down — since, we're also using Vitest.
Is there a workaround? Or should we rewrite all our libraries to use the legacy TypeScript decorators instead?
Beta Was this translation helpful? Give feedback.
All reactions