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

PERF: Improve performance of intellisens and IDE #1133

Closed
3 of 30 tasks
TheEisbaer opened this issue May 23, 2024 · 1 comment · Fixed by #1169
Closed
3 of 30 tasks

PERF: Improve performance of intellisens and IDE #1133

TheEisbaer opened this issue May 23, 2024 · 1 comment · Fixed by #1169
Labels
bug Something isn't working pull-request Pull request available 🔗 svelte package

Comments

@TheEisbaer
Copy link

Package

  • @tabler/icons
  • @tabler/icons-eps
  • @tabler/icons-pdf
  • @tabler/icons-png
  • @tabler/icons-webfont
  • @tabler/icons-sprite
  • @tabler/icons-preact
  • @tabler/icons-react
  • @tabler/icons-react-native
  • @tabler/icons-solid
  • @tabler/icons-svelte
  • @tabler/icons-vue
  • Figma plugin
  • source/main
  • other/not relevant

Version

@latest

Browser

  • Chrome/Chromium
  • Firefox
  • Safari
  • Edge
  • iOS Safari
  • Opera
  • Other/not relevant

Operating system

  • Windows
  • Linux
  • macOS
  • ChromeOS
  • iOS
  • Android
  • Other/not relevant

Description

VSCode and Intellisense (especially the language servers) are slowing down (taking up to 40 seconds for auto complete) because of the huge amount of export conditions (one for each icon) in the package.json

See sveltejs/language-tools#2244 for advice on fix for this

Steps to reproduce

  1. have svelte project and vscode extension for svelte language server installed
  2. install tabler icons for svelte
  3. try to do autocomplete -> takes up to 40 seconds to make auto complete suggestion
    4

Checklist

  • I have searched if someone has submitted a similar issue before and there weren't any. (Please make sure to also search closed issues, as this issue might already have been resolved.)
@TheEisbaer TheEisbaer added the bug Something isn't working label May 23, 2024
@TheEisbaer
Copy link
Author

TheEisbaer commented May 23, 2024

Proposed solution:

final package.json has to look like this:

"exports": {
    ".": {
      "types": "./dist/tabler-icons-svelte.d.ts",
      "svelte": "./dist/tabler-icons-svelte.js",
      "default": "./dist/tabler-icons-svelte.js"
    },
    "./icons": {
      "types": "./dist/tabler-icons-svelte.d.ts",
      "svelte": "./dist/tabler-icons-svelte.js"
    },
    "./icons/*": {
      "types": "./dist/icons/*.svelte.d.ts",
      "svelte": "./dist/icons/*.svelte"
    }
}

then you can import the icons like:

import IconAB from '@tabler/icons-svelte/icons/a-b'; // fast during build and dev server
// or
import { IconAB } from '@tabler/icons-svelte'; // still slow during build and dev server because vite still transforms every icon

Results in much faster IDE performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pull-request Pull request available 🔗 svelte package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants