diff --git a/src/vnodeTransformers/stubComponentsTransformer.ts b/src/vnodeTransformers/stubComponentsTransformer.ts index 6764aac1b..d2d44e973 100644 --- a/src/vnodeTransformers/stubComponentsTransformer.ts +++ b/src/vnodeTransformers/stubComponentsTransformer.ts @@ -1,4 +1,4 @@ -import type { VTUVNodeTypeTransformer } from './util' +import { isKeepAlive, isTeleport, VTUVNodeTypeTransformer } from './util' import { Transition, TransitionGroup, @@ -115,7 +115,7 @@ export function createStubComponentsTransformer({ }: CreateStubComponentsTransformerConfig): VTUVNodeTypeTransformer { return function componentsTransformer(type, instance) { // stub teleport by default via config.global.stubs - if ((type as any) === Teleport && 'teleport' in stubs) { + if (isTeleport(type) && 'teleport' in stubs) { if (stubs.teleport === false) return type return createStub({ @@ -126,7 +126,7 @@ export function createStubComponentsTransformer({ } // stub keep-alive/KeepAlive by default via config.global.stubs - if ((type as any) === KeepAlive && ('keep-alive' in stubs || 'KeepAlive' in stubs)) { + if (isKeepAlive(type) && ('keep-alive' in stubs || 'KeepAlive' in stubs)) { if ('keep-alive' in stubs && stubs['keep-alive'] === false) return type if ('KeepAlive' in stubs && stubs['KeepAlive'] === false) return type diff --git a/src/vnodeTransformers/util.ts b/src/vnodeTransformers/util.ts index d9e5f98ee..c79bccd86 100644 --- a/src/vnodeTransformers/util.ts +++ b/src/vnodeTransformers/util.ts @@ -20,8 +20,8 @@ export type VTUVNodeTypeTransformer = ( instance: InstanceArgsType ) => VNodeTransformerInputComponentType -const isTeleport = (type: any): boolean => type.__isTeleport -const isKeepAlive = (type: any): boolean => type.__isKeepAlive +export const isTeleport = (type: any): boolean => type.__isTeleport +export const isKeepAlive = (type: any): boolean => type.__isKeepAlive export const createVNodeTransformer = ({ transformers