Skip to content

Commit 9c88679

Browse files
committed
test: use @rollup/plugin-swc with rolldown-vite for ecma decorators
1 parent 153bb2a commit 9c88679

File tree

3 files changed

+203
-7
lines changed

3 files changed

+203
-7
lines changed

playground/vue-jsx-ts-built-in/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
},
1515
"devDependencies": {
1616
"@babel/plugin-syntax-decorators": "^7.27.1",
17+
"@rollup/plugin-swc": "^0.4.0",
18+
"@swc/core": "^1.13.5",
1719
"@vitejs/plugin-vue": "workspace:*",
1820
"@vitejs/plugin-vue-jsx": "workspace:*"
1921
}

playground/vue-jsx-ts-built-in/vite.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from 'vite'
2+
import * as vite from 'vite'
23
import vueJsxPlugin from '@vitejs/plugin-vue-jsx'
34
import vuePlugin from '@vitejs/plugin-vue'
45
import babelPluginSyntaxDecorators from '@babel/plugin-syntax-decorators'
@@ -17,6 +18,24 @@ export default defineConfig({
1718
],
1819
}),
1920
vuePlugin(),
21+
// rolldown-vite does not support ecma decorators yet, use SWC for them
22+
// https://github.com/oxc-project/oxc/issues/9170
23+
'rolldownVersion' in vite &&
24+
vite.withFilter(
25+
{
26+
...swc({
27+
swc: {
28+
jsc: {
29+
parser: { decorators: true, decoratorsBeforeExport: true },
30+
transform: { decoratorVersion: '2022-03' },
31+
},
32+
},
33+
}),
34+
},
35+
{
36+
transform: { id: /\/decorators\//, code: '@' },
37+
},
38+
),
2039
],
2140
build: {
2241
// to make tests faster

pnpm-lock.yaml

Lines changed: 182 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)