kit
kit copied to clipboard
Support for SvelteKit-specific apps
Describe the problem
prop:
Hey, so I'm creating a svelte library that doesn't use any dependencies. Problem is that my library won't work if I remove the svelte peerDependeny, unless I add ssr: { noExternal: ["library"] } to the vite config when using the lib. this is the issue im facing. Are there any workarounds for this? Not ideal having to add this to vite config when using the library nor is it ideal to have a useless peerDependency (edited)
Enrico (Etrain):
If you're creating a Svelte component library, then adding Svelte as a peerDependency is necessary since the user will require Svelte to use your library. Unless your library is strictly JS modules. Can you share it?
prop:
@ Enrico (Etrain) this is it https://github.com/propolies/svelte-api/tree/main/package I'm not using svelte in any way, only thing im using is sveltekits Request type.
Describe the proposed solution
Check if libraries have SvelteKit as a peer dep just as vite-plugin-svelte
does for Svelte
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
what could be possible solution of this? @benmccann
SvelteKit needs to add any packages which declare a peer dependency on SvelteKit to noExternal
just as vite-plugin-svelte
does for packages which declare a peer dependency on Svelte:
https://github.com/sveltejs/vite-plugin-svelte/blob/833d66cee57a0ec7cbfcf29b23796988dfdc7cf3/packages/vite-plugin-svelte/src/utils/options.js#L513