Skip to content

Commit ebdd5f2

Browse files
committed
feat: add parserOpts option
1 parent a5b5403 commit ebdd5f2

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,19 @@ The following show the default values of the configuration.
106106
```ts
107107
VueJsx({
108108
// filters for transforming targets
109-
include: [/\.[jt]sx?$/],
110-
exclude: undefined,
109+
include: [/\.[jt]sx$/],
110+
exclude: [/node_modules/],
111111
sourceMap: true,
112112

113-
// extra options from babel plugin: https://github.com/vuejs/babel-plugin-jsx#options
113+
// See https://babeljs.io/docs/babel-parser#options
114+
parserOpts: {
115+
plugins: [
116+
/* ... */
117+
],
118+
},
119+
120+
// Extra options from Vue Babel plugin: https://github.com/vuejs/babel-plugin-jsx#options
121+
// ...
114122
})
115123
```
116124

src/core/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ParserOptions } from '@babel/core'
12
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
23
import type { FilterPattern } from 'unplugin'
34

@@ -6,6 +7,7 @@ export type Options = {
67
exclude?: FilterPattern | undefined
78
enforce?: 'pre' | 'post' | undefined
89
sourceMap?: boolean
10+
parserOpts?: ParserOptions
911
} & VueJSXPluginOptions
1012

1113
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U

src/core/vue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function transformVueJsx(
1919
plugins: [[vue3Jsx, options]],
2020
sourceMaps: options.sourceMap,
2121
sourceFileName: id,
22+
parserOpts: options.parserOpts,
2223
}
2324

2425
if (isTS(id)) {

0 commit comments

Comments
 (0)