diff --git a/packages/babel-plugin-jsx/src/interface.ts b/packages/babel-plugin-jsx/src/interface.ts index e2aa08e..c403c9d 100644 --- a/packages/babel-plugin-jsx/src/interface.ts +++ b/packages/babel-plugin-jsx/src/interface.ts @@ -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 */ diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index 6e1d24d..db5790a 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -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), ]); }