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:
@@ -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}
|
||||
Reference in New Issue
Block a user