--- import { Image } from 'astro:assets' type Props = { name: string } const { name } = Astro.props const icons = Object.fromEntries( Object.entries( import.meta.glob<{ default: ImageMetadata }>(`node_modules/@phosphor-icons/core/assets/light/*.svg`), ).map(([path, module]) => [path.split('/').pop()!.split('.')[0].replace('-light', ''), module]), ) if (!icons[name]) { throw new Error(`Icon "${name}" not found`) } --- {name}