Commit 333bacb 1 parent c599a2e commit 333bacb Copy full SHA for 333bacb
File tree 1 file changed +19
-0
lines changed
packages/plugin-vue-jsx/src
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import jsx from '@vue/babel-plugin-jsx'
6
6
import { createFilter , normalizePath } from 'vite'
7
7
import type { ComponentOptions } from 'vue'
8
8
import type { Plugin } from 'vite'
9
+ // eslint-disable-next-line node/no-extraneous-import
10
+ import type { CallExpression , Identifier } from '@babel/types'
9
11
import type { Options } from './types'
10
12
11
13
export * from './types'
@@ -93,6 +95,23 @@ function vueJsxPlugin(options: Options = {}): Plugin {
93
95
] )
94
96
}
95
97
98
+ if ( ! ssr && ! needHmr ) {
99
+ plugins . push ( ( ) => {
100
+ return {
101
+ visitor : {
102
+ CallExpression : {
103
+ enter ( _path : babel . NodePath < CallExpression > ) {
104
+ if ( isDefineComponentCall ( _path . node ) ) {
105
+ const callee = _path . node . callee as Identifier
106
+ callee . name = `/* @__PURE__ */ ${ callee . name } `
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ } )
113
+ }
114
+
96
115
const result = babel . transformSync ( code , {
97
116
babelrc : false ,
98
117
ast : true ,
You can’t perform that action at this time.
0 commit comments