Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte gets very slow on hard refresh [dev env] #15603

Closed
elansx opened this issue Mar 24, 2025 · 4 comments
Closed

Svelte gets very slow on hard refresh [dev env] #15603

elansx opened this issue Mar 24, 2025 · 4 comments

Comments

@elansx
Copy link

elansx commented Mar 24, 2025

Describe the bug

I have noticed that svelte slows down significantly when hard refresh occurs when using any icon library (like lucide/svelte or tabler/icons-svelte), in development.

Up to few seconds to load the page, hot reloads seems to be working just fine.

It seems that app tries to load all icons at once every time.

Currently I'm bypassing this issue by making alias directly to node_modules, so i can import like this:
'@icons/arrow-left.svelte' and this solves the issue.

At first I though this was lucide issue, but once I installed tabler icons that was sure thing that this is svelte issue, because it loads even slower with tabler as they have much more icons available.

Reproduction

  1. Import icons via { YourIcon } from '@lucide/svelte' in <script> tags
  2. Render icons in your html
  3. Make hard refresh in browser.

Logs

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
    Memory: 5.84 GB / 15.94 GB
  Binaries:
    Node: 22.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355

Severity

annoyance

@henrykrinkle01
Copy link
Contributor

This is more about Vite than Svelte
A remedy:
https://github.com/WarningImHack3r/vite-plugin-lucide-preprocess

@elansx
Copy link
Author

elansx commented Mar 27, 2025

This is more about Vite than Svelte
A remedy:
https://github.com/WarningImHack3r/vite-plugin-lucide-preprocess

I think the plugin doesn't make sense, since you still need to import them one by one.

I will go with alias solution that I mentioned.

Still bothers me that this is ongoing issue for years now and is still existing issue today.

@henrykrinkle01
Copy link
Contributor

I think the plugin doesn't make sense, since you still need to import them one by one.

No you don't. This works:

import { Icon1, Icon2 } from 'lucide-svelte';

@dummdidumm
Copy link
Member

This is a Vite problem, or rather an "icon library having one export per Icon" problem. Also see https://svelte.dev/docs/kit/icons - therefore closing.

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants