Description
Is your feature request related to a problem? Please describe.
Vite will exclude many node_modules
packages from the SSR bundle it generates, using a set of heuristics. While they're subject to change, those heuristics typically exclude Svelte component libraries from the bundle, and so we need to explicitly add them to ssr.noExternal
, as in #806 or the kit.svelte.dev config.
Describe the solution you'd like
A convention exists for declaring a package to be a component library — pkg.svelte
. It's not used universally (e.g. Svelte GL and site-kit don't use it, which I was slightly surprised about. not sure what i was thinking) but with #518 we can make it more of a standard.
We could forcibly add packages with a pkg.svelte
to ssr.noExternal
, in addition to any values the user may have specified. This would reduce the number of bugs along the lines of #806.
Relatedly, I can't remember the reason we added the current ssr.noExternal
block to the template...
kit/packages/create-svelte/template/svelte.config.cjs
Lines 15 to 19 in ccb8825
Describe alternatives you've considered
Solve it with documentation. We could also force devDependencies
to always be bundled rather than dependencies
, and expect people to understand the difference.
How important is this feature to you?
Not solving this one way or another is going to cause people to get mad at us.