open-source-labs / Svelvet

🎛 A Svelte library for building dynamic, infinitely customizable node-based user interfaces and flowcharts
https://svelvet.io
2.5k stars 161 forks source link

Is there any way to avoid drawer and minimap getting in the bundle? #492

Open leejuyuu opened 7 months ago

leejuyuu commented 7 months ago

Hello, thanks for making this excellent library!

I have a question about reducing the bundle size. When I create a minimum graph without using minimap and drawers explicitly, these components are still included in the bundle and they take at least 80 KB. Is there any way to avoid them being included in the final bundle when not needed in the app?

A minimum working example:

  1. create-vite-app to create a svelte project (without sveltekit).
  2. Install svelvet (I am on 9.0.0).
  3. Replace the App.svelte with the following code (modified from the docs).
  4. Run vite-bundle-visualizer to see the final bundle.
    
    // App.svelte
    <script>
    import { Node, Svelvet } from 'svelvet';
    </script>