sveltestrap
sveltestrap copied to clipboard
Browser downloads all components in SvelteKit
I'm somewhat confused by this. When I import a component (just a Button for example), it automatically downloads all other components:

This makes e.g. reloading very slow since it has to load all components. I'm importing them like so:
import { Button } from 'sveltestrap';
When I use
import Button from 'sveltestrap/src/Button.svelte';
it works but this is rather cumbersome since I have to type it out manually instead of letting my IDE complete it. Am I missing something or am I understanding something wrong?
Hi @Brawl345 , I've not been keeping up with the status of Sveltekit, as it seems to be changing quite a bit.
If you are using Sveltestrap in an SSR environment such as Sapper, the previous recommendation was you import the component src directly:
import { Card } from 'sveltestrap/src';
But I thought this was unnecessary in sveltekit.
Same problem with your import:

I'm not really sure what the recommended practice is with Sveltekit. I'm assuming it's reading the index.js and seeing all the imports, but this works fine with sapper and rollup. I'm happy to update our dist with whatever would improve this, but would need some help sorting through what Sveltekit needs here.
This should now be addressed with the latest SvelteKit, which prebundles Svelte libraries: https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#prebundlesveltelibraries