Skip to content

[vite-plugin-svelte] prebundle libraries / ssr compile stats show large numbers #1561

@dominikg

Description

@dominikg

This is not a bug in carbon-components-svelte, posting here for visibility and as a heads-up for the maintainers and users.

In version 1.3.0 , vite-plugin-svelte is going to enable prebundling for svelte dependencies during dev by default.
Alongside, it is going to log compile statistics so users can understand where time is spent.

For a sveltekit application with carbon-components-svelte and carbon-icons-svelte this can look like

1:54:40 PM [vite-plugin-svelte] prebundle libraries in progress ...
1:54:55 PM [vite-plugin-svelte] ssr compile in progress ...
1:55:05 PM [vite-plugin-svelte] prebundle libraries done.
package                         files     time     avg
carbon-icons-svelte              2002   11.30s   5.6ms
carbon-components-svelte          206    2.68s  13.0ms
1:55:05 PM [vite-plugin-svelte] ssr compile done.
package                                 files    time     avg
carbon-icons-svelte                      2002   2.92s   1.5ms
carbon-components-svelte                  206   0.60s   2.9ms
playground-big-component-library-kit        3   9.8ms   3.3ms

and delay initial page load of the dev-server by multiple seconds.

Using the optimizeImports preprocessor in combination with prebundling can make it a lot worse even.

For using carbon with vite-plugin-svelte 1.3+ it is recommended to either not use optimizeImports and stick to one import style or exclude carbon from optimizeDeps as described in the vite-plugin-svelte FAQ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions