Skip to content

Commit be3eca0

Browse files
authored
feat: add allowDeclareFields for babel ts option (#4)
1 parent 1424416 commit be3eca0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function vue2JsxPlugin(options: Options = {}): Plugin {
9696
// use id for script blocks in Vue SFCs (e.g. `App.vue?vue&type=script&lang.jsx`)
9797
// use filepath for plain jsx files (e.g. App.jsx)
9898
if (filter(id) || filter(filepath)) {
99-
const plugins = [importMeta, ...babelPlugins]
99+
const plugins = [importMeta]
100100
const presets = [
101101
[jsx, {
102102
compositionAPI: 'native',
@@ -110,10 +110,11 @@ function vue2JsxPlugin(options: Options = {}): Plugin {
110110
(r) => r.default
111111
),
112112
// @ts-ignore
113-
{ isTSX: true, allowExtensions: true }
113+
{ isTSX: true, allowExtensions: true, allowDeclareFields: true }
114114
])
115115
}
116-
116+
// custom babel plugins should put *after* ts plugin
117+
plugins.push(...babelPlugins)
117118
const result = babel.transformSync(code, {
118119
babelrc: false,
119120
ast: true,

0 commit comments

Comments
 (0)