perf: lazy-load @mdi/js to reduce Vite dev server memory usage

Replace `import * as mdi from '@mdi/js'` (loads ~5MB of SVG paths
synchronously into every HMR update) with a lazy async import that
loads once and caches. MdiIcon and IconPicker now use getMdiPath()
and getAllMdiNames() from the shared mdi-lookup module.
This commit is contained in:
2026-03-22 01:26:08 +03:00
parent a7829c48a4
commit 826be4c347
3 changed files with 138 additions and 0 deletions
@@ -0,0 +1,9 @@
<script lang="ts">
import { getMdiPath } from '$lib/mdi-lookup';
let { name = '', size = 18 } = $props<{ name: string; size?: number }>();
</script>
{#if name && getMdiPath(name)}
<svg viewBox="0 0 24 24" width={size} height={size} fill="currentColor"><path d={getMdiPath(name)} /></svg>
{/if}