#The ultimate Icon component

3 messages · Page 1 of 1 (latest)

wind remnant
#

I'm trying to create an Icon component that imports svgs dynamically without blowing up the bundle size.
I've gathered all the potential solutions we can find on the web, like require.context(), dynamic(), await import(), etc. but all of them are making the bundle size huge. Only one does not do that but it involves loading the svgs client side meaning that the svgs appear on the page after a delay.

I've set a repo with everything I tried but I still not have a good solution
The repo: https://github.com/pepew-le-boss/dynamic-icons-nextjs

GitHub

Trying to find the best way to make an Icon component that imports svgs dynamically while keeping an optimized bundle size - pepew-le-boss/dynamic-icons-nextjs

winged perchBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

wind remnant