tabler / tabler-icons

A set of over 5400 free MIT-licensed high-quality SVG icons for you to use in your web projects.
https://tabler.io/icons
MIT License
17.84k stars 886 forks source link

icons-svelte on dev server loads ALL icons, even ones not used #1003

Open MarArMar opened 6 months ago

MarArMar commented 6 months ago

Probably related to https://github.com/tabler/tabler-icons/issues/669

See my network tab on my dev server : 5k requests are made, the overwhelming majority for Icons I do not use (here I literally do not see a single one I use)

image

Versions tested : "@tabler/icons-svelte": "2.47.0", "@tabler/icons-svelte": "2.30.0",

With

"vite": "^5.0.3",
"svelte": "^4.2.7",
"@sveltejs/kit": "^2.0.0",
MarArMar commented 6 months ago

Those are my vite.config.settings :

    optimizeDeps: {
      disabled: 'dev',
      noDiscovery: true,
     },
  }

If I remove them, it only loads the necessary images, but the dependencies optimization step takes >40 seconds and I would like to skip it

dev: 19:38:36 [vite] ✨ optimized dependencies changed. reloading dev: 19:39:13 [vite] ✨ new dependencies optimized: @tabler/icons-svelte, lucide-svelte, radix-icons-svelte, sveltejs-tippy

MarArMar commented 6 months ago

Temporary fix :

Set to this version in package.json :

"@tabler/icons-svelte": "2.30.0",