diff --git a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts index 7a22bdc..ad84d55 100644 --- a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts +++ b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts @@ -46,7 +46,7 @@ const getJSXAttributeValue = ( const buildProps = (path: NodePath, state: State) => { const tag = getTag(path, state); - const isComponent = checkIsComponent(path.get('openingElement')); + const isComponent = checkIsComponent(path.get('openingElement'), state); const props = path.get('openingElement').get('attributes'); const directives: t.ArrayExpression[] = []; const dynamicPropNames = new Set(); diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index eae7d53..cca2af2 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -41,7 +41,7 @@ export const shouldTransformedToSlots = (tag: string) => !(tag.endsWith(FRAGMENT * @param path JSXOpeningElement * @returns boolean */ -export const checkIsComponent = (path: NodePath): boolean => { +export const checkIsComponent = (path: NodePath, state: State): boolean => { const namePath = path.get('name'); if (namePath.isJSXMemberExpression()) { @@ -50,6 +50,10 @@ export const checkIsComponent = (path: NodePath): boolean = const tag = (namePath as NodePath).node.name; + if (state.opts.isCustomElement && state.opts.isCustomElement(tag)) { + return false; + } + return shouldTransformedToSlots(tag) && !htmlTags.includes(tag) && !svgTags.includes(tag); };