rollup-plugin-svelte-svg
rollup-plugin-svelte-svg copied to clipboard
Support dynamic import
trafficstars
To be able to import it in a dynamic way in order to get the name of the icon to be imported through a prop, something like this:
<script>
import { onMount } from 'svelte'
export let name
let SVGComponent
onMount(async () => {
const SVG = await import(`@assets/icons/${name}.svg`)
SVGComponent = SVG
})
</script>
<svelte:component this={SVGComponent}/>
Any updates on this yet?