import { Component , defineAsyncComponent , getCurrentInstance } from 'vue' ; export function useComponents ( components ) { const instance = getCurrentInstance ( ) ; if ( instance != null ) { const { app } = instance . appContext ; Object . entries ( components ) . forEach ( ( [ name , component ] ) => { app . component ( name , typeof component === 'function' ? defineAsyncComponent ( component as any ) : component ) ; } ) ; } }