benflap / tabler-icons-svelte

A library of SVG Svelte components for Tabler Icons.
MIT License
62 stars 7 forks source link

build time #1

Open russellsamora opened 3 years ago

russellsamora commented 3 years ago

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?

benflap commented 3 years ago

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.

jmsunseri commented 3 years ago

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

benflap commented 3 years ago

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.

jmsunseri commented 3 years ago

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

georks commented 3 years ago

Same build issue here. A cold / first npm run devin 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.

benflap commented 3 years ago

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.