braebo / sveltekit-electron

Minimal Sveltekit + Electron starter template.
MIT License
269 stars 27 forks source link

Updating the SvelteKit config file to comply with the new changes to Sveltekit SSR #16

Closed xmaayy closed 2 years ago

xmaayy commented 2 years ago

Changes

SvelteKit made some changes to how you disable SSR. Without the changes you get the following error. This should solve issue #15

[svelte] > config.kit.ssr has been removed — use the handle hook instead: https://kit.svelte.dev/docs#hooks-handle
[svelte]     at file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:650:12
[svelte]     at file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:729:43
[svelte]     at file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:715:18
[svelte]     at file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:715:18
[svelte]     at validate_config (file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:874:9)
[svelte]     at load_config (file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:851:20)
[svelte]     at async file:///Users/x/Documents/p/sveltekit-electron/node_modules/@sveltejs/kit/dist/cli.js:948:19
[svelte] npm run dev:svelte exited with code 1

If you don't have these changes you get stuck in an infinite loop of

[electron] Error loading URL, retrying Error: ERR_CONNECTION_REFUSED (-102) loading 'http://localhost:3000/'
[electron]     at rejectAndCleanup (electron/js2c/browser_init.js:217:1457)
[electron]     at Object.failListener (electron/js2c/browser_init.js:217:1670)
[electron]     at Object.emit (events.js:315:20) {
[electron]   errno: -102,
[electron]   code: 'ERR_CONNECTION_REFUSED',
[electron]   url: 'http://localhost:3000/'
[electron] }

Does everything work the same

Yep, with no other changes it starts up fine image

braebo commented 2 years ago

Awesome- thanks!