Open mustafa0x opened 2 months ago
I noticed this too and ended up replacing with svelte-french-toast
It's quite confusing to me. There's no clear culprit, other than the generated code being huge. There are a few things that would help (eg extracting out the svg, or making it a raw string), but no clear low hanging fruit.
I think Svelte 5 will reduce the bundle size a fair bit.
replacing svgs with <img src="path/to/svg-file.svg" />
would definitely reduce bundle size
My app
$> du -hs dist/{bundle.es.js,bundle-final.js}
216K dist/bundle.es.js
96K dist/bundle-final.js
After adding svelte-french-toast
.
$> du -hs dist/{bundle.es.js,bundle-final.js}
280K dist/bundle.es.js
116K dist/bundle-final.js
So it adds 64k, and 20k minified. A lot more reasonable.
I think Svelte 5 will reduce the bundle size a fair bit.
250.80 kB with, 191.62 kB without (minified: 102.6 kB / 79 kB). So around 50% less than svelte 4.
Which is a lot better. 24kb minified is still a bit on the larger side though.
First, thanks for svelte-sonner. It's quite a nice toast component.
Second, I replaced my hand rolled toast component with sonner, and saw bundle.es.js grow by 110kb (50kb after minifying). I didn't expect such an increase!
I diffed the bundles to see if there was a single culprit. However it was mostly the generated svelte code for the sonner component. So there doesn't seem to be any simple fix to this problem.
I copied the added code to a gist (4k lines!), for whomever is curious to see what was added.