Commit 9a0773e 1 parent efa4e4d commit 9a0773e Copy full SHA for 9a0773e
File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ declare interface FilterOptions {
8
8
}
9
9
10
10
declare function createPlugin (
11
- options ?: VueJSXPluginOptions & FilterOptions
11
+ options ?: VueJSXPluginOptions & FilterOptions & { babelPlugins ?: any [ ] }
12
12
) : Plugin
13
13
14
14
export default createPlugin
Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ function ssrRegisterHelper(comp, filename) {
30
30
31
31
/**
32
32
* @typedef { import('@rollup/pluginutils').FilterPattern } FilterPattern
33
- * @typedef { { include?: FilterPattern, exclude?: FilterPattern } } CommonOtions
33
+ * @typedef { { include?: FilterPattern, exclude?: FilterPattern, babelPlugins?: any[] } } CommonOptions
34
34
*/
35
35
36
36
/**
37
37
*
38
- * @param {import('@vue/babel-plugin-jsx').VueJSXPluginOptions & CommonOtions } options
38
+ * @param {import('@vue/babel-plugin-jsx').VueJSXPluginOptions & CommonOptions } options
39
39
* @returns {import('vite').Plugin }
40
40
*/
41
41
function vueJsxPlugin ( options = { } ) {
@@ -78,12 +78,21 @@ function vueJsxPlugin(options = {}) {
78
78
} ,
79
79
80
80
transform ( code , id , ssr ) {
81
- const { include, exclude, ...babelPluginOptions } = options
81
+ const {
82
+ include,
83
+ exclude,
84
+ babelPlugins = [ ] ,
85
+ ...babelPluginOptions
86
+ } = options
82
87
83
88
const filter = createFilter ( include || / \. [ j t ] s x $ / , exclude )
84
89
85
90
if ( filter ( id ) ) {
86
- const plugins = [ importMeta , [ jsx , babelPluginOptions ] ]
91
+ const plugins = [
92
+ importMeta ,
93
+ [ jsx , babelPluginOptions ] ,
94
+ ...babelPlugins
95
+ ]
87
96
if ( id . endsWith ( '.tsx' ) ) {
88
97
plugins . push ( [
89
98
require ( '@babel/plugin-transform-typescript' ) ,
You can’t perform that action at this time.
0 commit comments