Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sveltekit & Tauri Update requiring SSR toggle to migrate from svelte.config.js to hooks file #13

Closed
wants to merge 7 commits into from
Closed

Sveltekit & Tauri Update requiring SSR toggle to migrate from svelte.config.js to hooks file #13

wants to merge 7 commits into from

Conversation

jsmenzies
Copy link

First of all thank you for this project, I found it incredibly useful when creating my Svelte-Kit/Tauri application.

I attempted to replicate this project but due to breaking changes both in SK and Tauri including one deployed today (https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fadapter-static%401.0.0-next.29) I spent ages trying to figure out how to disable SSR site wide.

The result seems to be relatively simple but it took a lot of trial and error.

To summarise:

  • svelte.config.js config.kit.ssr flag is not longer supported
  • new tauri api/cli RCs fail to load since SSR is enabled
  • sveltekit supports the ability to toggle SSR off on a per request basis using a handle hook (https://kit.svelte.dev/docs/hooks#handle)
  • sveltekit warns of tsconfig not extending the base SK config and without the paths options including $lib and $lib/* paths.
  • vite failing to reload due to misconfigured tsconfig

I have fixed all the above and bumped the app verison to 0.0.3 and included all latest dependencies. I have tested the functionality and it remains the same but using the latest SK/Tauri/Other dependencies.

This app serves as a brilliant example/template for the very new SK/Tauri applications. I assume as both frameworks are up and coming (pre first release) more breaking changes will occur. I will attempt to keep this app up to date in the hope that it benefits others like me who are experimenting with SK/Tauri.

@jsmenzies
Copy link
Author

Hi @lukeed, I know you're probably busy but any chance to get this merged in, if you approve of it.

Cheers

@lukeed
Copy link
Contributor

lukeed commented Mar 8, 2022

Hey, thanks for this! Haven't had a chance to check it out yet, but FYI my gameplan was to revisit this repo & update everything once both tools reached a RC-stage. Tauri is there & SvelteKit is nearly there. Both were under active development & I wasn't interested in constantly updating the dependencies list – hence the pinned versions

@jsmenzies
Copy link
Author

Thanks for taking time to respond,

Sure I understand your point, no need to do the work twice. The PR is fairly minimal if you get the chance to take a look that's cool if not I'd be happy to update this PR to the RCs once they're out.

My main motivation was to update it to help out anyone reading your blog post or using this as a template as it's significantly behind the lastest SK/Tauri (I totally understand why) hence the PR.

@Eudritch
Copy link

Eudritch commented Aug 7, 2022

To answer your question, I created a functioning SvelteKit template SvelteKit-Tauri-Template to disable SSR. Create a hoork.js/.ts file with following code snippet.

export const handle = async ({ event, resolve }) => {
	const response = await resolve(event, {
		ssr: false
	});
	return response;
};

Everything you'll need to create a tauri app is set up in my simple template, including tauri autostart when you execute npm run dev

@jsmenzies jsmenzies closed this by deleting the head repository Apr 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants