Skip to content

Commit

Permalink
feat: add isGlobalElement option
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj committed Nov 27, 2024
1 parent 1d6003c commit 041d15c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/babel-plugin-jsx/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface VueJSXPluginOptions {
mergeProps?: boolean;
/** configuring custom elements */
isCustomElement?: (tag: string) => boolean;
/** configuring global elements */
isGlobalElement?: (tag: string) => boolean;
/** enable object slots syntax */
enableObjectSlots?: boolean;
/** Replace the function used when compiling JSX expressions */
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-jsx/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export const getTag = (
? t.identifier(name)
: state.opts.isCustomElement?.(name)
? t.stringLiteral(name)
: t.callExpression(createIdentifier(state, 'resolveComponent'), [
: state.opts.isGlobalElement?.(name)
? t.identifier(name)
: t.callExpression(createIdentifier(state, 'resolveComponent'), [
t.stringLiteral(name),
]);
}
Expand Down

0 comments on commit 041d15c

Please sign in to comment.