tabler-icons-svelte icon indicating copy to clipboard operation
tabler-icons-svelte copied to clipboard

build time

Open russellsamora opened this issue 3 years ago • 6 comments

This is great! Excited to use it, but it seems to increase build time for me by about 6 seconds (1.8s to 8.6s) and really slows things down. Any way to optimize it?

russellsamora avatar Nov 02 '20 10:11 russellsamora

Wow that is a lot longer. I'm new to Svelte so I will have to do some digging to find ways to optimize this package.

benflap avatar Nov 03 '20 00:11 benflap

I noticed this build issue as well. It's running a bunch of scripts during build?

jmsunseri avatar Jan 02 '21 04:01 jmsunseri

I looked at how svelte-material-ui optimized there library. What they did was create a different package for every type of component. This is harder to do for this library because the components need to be recreated every time tabler-icons is updated.

I also don’t see this as that big of an issue for development. As long as you use the --watch option with rollup, or if you are using sapper sapper dev, Rollup will only recompile the components that have changed. Meaning this is only a problem for when you build for deployment. If your configuration doesn’t work like that look at the svelte template or the sapper template.

benflap avatar Jan 02 '21 17:01 benflap

i switched over to usning snowpack to do my dev builds and since it uses modules the build is almost instant when you make a change. I did notice this however. I'm only using a handful of icons. This seems like a pretty large file

image

jmsunseri avatar Jan 10 '21 10:01 jmsunseri

Same build issue here. A cold / first npm run dev in sapper took up to 30s, rebuilding up to 8s and slows things down. (OK my machine is not the latest but fast enough for almost everything...)

A working solution for me is to import every icon directly, like this:

import Bell from "tabler-icons-svelte/dist/Bell.svelte";

Hope this can be of help.

georks avatar Jan 21 '21 17:01 georks

import Bell from "tabler-icons-svelte/dist/Bell.svelte";

@georks I don't know why I didn't think of that.

I'll update the readme to add that tip.

benflap avatar Jan 21 '21 19:01 benflap