const customComponents = import.meta.glob('@components/**/*.vue')
const coreComponents = import.meta.glob('@core/**/*.vue')
export function useComponentRegistry(componentPath: string) {
const customPath = `/components/custom/${componentPath}.vue`;
const corePath = `/components/core/${componentPath}.vue`;
const loader =
customComponents[customPath] || coreComponents[corePath]
if (!loader) {
throw new Error(`Component not found in custom or core: ${componentPath}`)
}
return defineAsyncComponent(() =>
loader().then((mod) => mod.default)
)
}
const customComponents = import.meta.glob('@components/**/*.vue')
const coreComponents = import.meta.glob('@core/**/*.vue')
export function useComponentRegistry(componentPath: string) {
const customPath = `/components/custom/${componentPath}.vue`;
const corePath = `/components/core/${componentPath}.vue`;
const loader =
customComponents[customPath] || coreComponents[corePath]
if (!loader) {
throw new Error(`Component not found in custom or core: ${componentPath}`)
}
return defineAsyncComponent(() =>
loader().then((mod) => mod.default)
)
}