File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/plugin-vue-jsx/src Expand file tree Collapse file tree 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'
66import { createFilter , normalizePath } from 'vite'
77import type { ComponentOptions } from 'vue'
88import type { Plugin } from 'vite'
9+ // eslint-disable-next-line node/no-extraneous-import
10+ import type { CallExpression , Identifier } from '@babel/types'
911import type { Options } from './types'
1012
1113export * from './types'
@@ -93,6 +95,23 @@ function vueJsxPlugin(options: Options = {}): Plugin {
9395 ] )
9496 }
9597
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+
96115 const result = babel . transformSync ( code , {
97116 babelrc : false ,
98117 ast : true ,
You can’t perform that action at this time.
0 commit comments