Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Dynamic import of fortawesome pro icons in svelte / vite

$
0
0

I'm attempting to dynamically import fortawesome icons in my sveltekit project, and struggling with the proper format. This is my test:

onMount(async () => {        let icons = ['faGear', 'faCarrot', 'faHandSparkle']        for (const iconName of icons) {            await import(`@fortawesome/pro-regular-svg-icons/${iconName}.js`)        }    })

I get a vite error that this import can't be analyzed, and to provide an absolute path. I'm not sure how to point to these using an absolute path, or if we can even import js libs like this. Anyone know how to resolve? Thank you


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>