Skip to content

Commit 117b25a

Browse files
authored
fix: should check isCustomElement (#431)
* fix: respect isCustomElement * chore: yarn lint
1 parent 77ed541 commit 117b25a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/babel-plugin-jsx/src/transform-vue-jsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const getJSXAttributeValue = (
4646

4747
const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
4848
const tag = getTag(path, state);
49-
const isComponent = checkIsComponent(path.get('openingElement'));
49+
const isComponent = checkIsComponent(path.get('openingElement'), state);
5050
const props = path.get('openingElement').get('attributes');
5151
const directives: t.ArrayExpression[] = [];
5252
const dynamicPropNames = new Set<string>();

packages/babel-plugin-jsx/src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const shouldTransformedToSlots = (tag: string) => !(tag.endsWith(FRAGMENT
4141
* @param path JSXOpeningElement
4242
* @returns boolean
4343
*/
44-
export const checkIsComponent = (path: NodePath<t.JSXOpeningElement>): boolean => {
44+
export const checkIsComponent = (path: NodePath<t.JSXOpeningElement>, state: State): boolean => {
4545
const namePath = path.get('name');
4646

4747
if (namePath.isJSXMemberExpression()) {
@@ -50,6 +50,10 @@ export const checkIsComponent = (path: NodePath<t.JSXOpeningElement>): boolean =
5050

5151
const tag = (namePath as NodePath<t.JSXIdentifier>).node.name;
5252

53+
if (state.opts.isCustomElement && state.opts.isCustomElement(tag)) {
54+
return false;
55+
}
56+
5357
return shouldTransformedToSlots(tag) && !htmlTags.includes(tag) && !svgTags.includes(tag);
5458
};
5559

0 commit comments

Comments
 (0)