--- import { parse } from 'node-html-parser'; export interface Props { icon: string; class?: string; } async function getSVG(name: string) { const filepath = `/src/icons/${name}.svg`; const files = import.meta.glob('/src/icons/**/*.svg', { query: '?raw', eager: true, }); if (!(filepath in files)) { throw new Error(`${filepath} not found`); } const root = parse((files[filepath] as any).default as string); const svg = root.querySelector('svg'); return { attributes: svg?.attributes, innerHTML: svg?.innerHTML, }; } const { icon, ...attributes } = Astro.props as Props; const { attributes: baseAttributes, innerHTML } = await getSVG(icon); const svgAttributes = { ...baseAttributes, ...attributes }; ---