Skip to content

Commit

Permalink
feat: add allowDeclareFields for babel ts option (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
troy351 authored Aug 8, 2022
1 parent 1424416 commit be3eca0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function vue2JsxPlugin(options: Options = {}): Plugin {
// use id for script blocks in Vue SFCs (e.g. `App.vue?vue&type=script&lang.jsx`)
// use filepath for plain jsx files (e.g. App.jsx)
if (filter(id) || filter(filepath)) {
const plugins = [importMeta, ...babelPlugins]
const plugins = [importMeta]
const presets = [
[jsx, {
compositionAPI: 'native',
Expand All @@ -110,10 +110,11 @@ function vue2JsxPlugin(options: Options = {}): Plugin {
(r) => r.default
),
// @ts-ignore
{ isTSX: true, allowExtensions: true }
{ isTSX: true, allowExtensions: true, allowDeclareFields: true }
])
}

// custom babel plugins should put *after* ts plugin
plugins.push(...babelPlugins)
const result = babel.transformSync(code, {
babelrc: false,
ast: true,
Expand Down

0 comments on commit be3eca0

Please sign in to comment.