You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the implementation would be pretty simple.
We can add a config to enable this behavior, so this wouldn't be the default, but it could be enabled.
Something like: server.swc: boolean | Options, default: false
Alternatively we can mention this shortcoming in the docs and guide users to add support themselves. (to avoid including unnecessary dependencies in vike-server, swc downloads around 30MB of binaries)
But it would be nice to have support built-in. 😄
The text was updated successfully, but these errors were encountered:
nitedani
changed the title
Support Typescript decorators
Support Typescript decorator metadata
Mar 26, 2025
🤔 I'm not sure how common the usage of decorator is right now, so until we have multiple user reporting issues, I would only mention somewhere in the doc that one can use esbuild-plugin-swc in their Vite config.
Vite uses esbuild to transpile TypeScript into JavaScript
Esbuild doesn't support emitting typescript decorator metadata. evanw/esbuild#257
Solution: avoid Vite's esbuild transpilation and use swc instead. (until Rolldown is here and supports this)
There are multiple ways to do add the swc transform:
Setting
esbuild: false
in Vite config,Adding the swc transform using the Vite transform hook:
Example implementation: https://github.com/unplugin/unplugin-swc/blob/main/src/index.ts
Adding an esbuild plugin to
esbuild.plugins
that does the swc transform:Example implementation: https://github.com/Fullscript/esbuild-plugin-swc/blob/main/src/index.ts
So the implementation would be pretty simple.
We can add a config to enable this behavior, so this wouldn't be the default, but it could be enabled.
Something like:
server.swc: boolean | Options, default: false
Alternatively we can mention this shortcoming in the docs and guide users to add support themselves. (to avoid including unnecessary dependencies in
vike-server
, swc downloads around 30MB of binaries)But it would be nice to have support built-in. 😄
The text was updated successfully, but these errors were encountered: