Skip to content

Commit e675f68

Browse files
committed
vite: use babel to transform decorators
1 parent 76b5c06 commit e675f68

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
"rollup-plugin-visualizer": "7.0.x",
105105
"esbuild": "0.28.x",
106106
"terser": "5.48.x",
107+
"@rolldown/plugin-babel": "0.2.x",
108+
"@babel/plugin-proposal-decorators": "8.0.x",
107109
"mocha": "11.7.x",
108110
"mocha-junit-reporter": "2.x",
109111
"chai": "6.x",
@@ -123,9 +125,6 @@
123125
"@types/tmp": "^0.2.6"
124126
},
125127
"mocha": {
126-
"extension": [
127-
"ts"
128-
],
129128
"node-option": [
130129
"import=tsx"
131130
],

package.json.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ devDependencies:
184184
'esbuild': '0.28.x'
185185
'terser': '5.48.x'
186186
187+
'@rolldown/plugin-babel': '0.2.x'
188+
'@babel/plugin-proposal-decorators': '8.0.x'
189+
187190
### testing
188191
189192
'mocha': '11.7.x'
@@ -209,7 +212,6 @@ devDependencies:
209212
"@types/tmp": "^0.2.6"
210213
211214
mocha:
212-
extension: ['ts']
213215
'node-option': [ "import=tsx" ]
214216
file:
215217
'test/lib/globals.ts'

vite.config.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { defineConfig } from 'vite';
55
import { checker } from 'vite-plugin-checker';
66
import dts from 'unplugin-dts/vite'
77

8+
import babel from "@rolldown/plugin-babel"
9+
810
import livescript from "./lib/rollup-plugin-livescript.js";
911
import peggy from "./lib/vite-plugin-peggy.ts";
1012

@@ -23,9 +25,21 @@ export default defineConfig({
2325
logLevel: "info",
2426

2527
plugins: [
26-
// checker({
27-
// typescript: true
28-
// }),
28+
checker({
29+
typescript: true
30+
}),
31+
32+
babel({
33+
presets: [{
34+
preset: () => ({
35+
plugins: [["@babel/plugin-proposal-decorators", { version: "2023-11" }]]
36+
}),
37+
rolldown: {
38+
filter: { code: "@" }
39+
}
40+
}]
41+
}),
42+
2943
livescript(),
3044
peggy({
3145
plugins: [ignoreInfiniteLoop],

0 commit comments

Comments
 (0)