kit icon indicating copy to clipboard operation
kit copied to clipboard

Support for SvelteKit-specific apps

Open benmccann opened this issue 1 year ago • 2 comments

Describe the problem

Screenshot from 2023-11-29 09-57-12

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

benmccann avatar Nov 29 '23 17:11 benmccann

what could be possible solution of this? @benmccann

Rishab49 avatar Dec 01 '23 15:12 Rishab49

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

benmccann avatar Jan 04 '24 17:01 benmccann