Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Replace svelte template with sveltekit #340

Closed
beeb opened this issue Feb 23, 2023 · 8 comments
Closed

Replace svelte template with sveltekit #340

beeb opened this issue Feb 23, 2023 · 8 comments

Comments

@beeb
Copy link
Contributor

beeb commented Feb 23, 2023

Sveltekit is the current de-facto standard for building svelte front-end applications. Even the project's homepage instructs to use npm create svelte@latest myapp which sets up a sveltekit project.

I would recommend to replace the svelte template with sveltekit, to bring all the additional benefits compared to bare svelte: built-in router, form handling, api routes and much much more.

@beeb beeb mentioned this issue Feb 23, 2023
19 tasks
@FabianLars
Copy link
Member

The problem with sveltekit in context of a tauri app is its SSR-first approach which doesn't pair well with Tauri.
Sure, there is the static adapter and you can turn off SSR mode per page etc., but it's stuff people have to think&care about which imho is not beginner friendly enough for create-tauri-app (in the context of trimming it down to 5 templates).

Take that with a grain of salt though, I am a bit biased here because i tend to be the person who has to deal with most users' problems on discord etc

@beeb
Copy link
Contributor Author

beeb commented Feb 23, 2023

Hey! Thanks for the input. Right I hadn't thought about the fact that some features are not really available when using the static adapter. I'm currently building something with sveltekit and I'll see how quickly I encounter problems, and then maybe I'll change my mind!

@amrbashir
Copy link
Member

amrbashir commented Feb 25, 2023

I don't really think that SSR-first version of a framework is ever going to be included in CTA again because usually it needs a lot more configuration and overhead to disable SSR which is the main feature so it makes sense to choose SPA by default.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2023
@kholbekj
Copy link

kholbekj commented Mar 3, 2023

Excluding it for maintainability is super fair - talking about sense making, I think anything that gets users working on what they care about fast has merits, and SvelteKit does that. The amount of work you have to do with the raw svelte app to even have two different pages is just not a great prototyping experience, in my opinion.

Maybe the purpose of CTA could be more explicitly stated somewhere, I mistakenly thought it was to help get over all that initial configuration and into build mode, but excluding SvelteKit on account of much configuration seems to indicate the opposite?

@amrbashir
Copy link
Member

The amount of work you have to do with the raw svelte app to even have two different pages is just not a great prototyping experience, in my opinion.

Same goes for React, Solid and even Vue but that is not a bad thing IMO, we give a starter and then you start composing your project as your needs grow.

I know that SvelteKit has nice features overall but if I have to choose Svelte vs SvelteKit for create-tauri-app, I'd choose Svelte as it covers more user base because a SvelteKit user knows Svelte while the opposite is not true.

@orcharddweller
Copy link

I second this, Sveltekit is built by the same team as Svelte, there is no easy way to create a Svelte app without kit.

npm create svelte creates a Sveltekit app.

There is no routing solution for Svelte without the kit. It's not like the React ecosystem, where there's a multitude of different options.

The most starred alternative, https://github.com/EmilTholin/svelte-routing, recommends using Sveltekit instead.

While this decision seems to be in good faith, I believe it significantly increases the difficulty of using Tauri for Svelte users.

Also, there are no Svelte docs for adding kit to regular Svelte, as Sveltekit is the default.

@FinalSh4re
Copy link

As someone who is new to tauri (and Svelte for that matter) I can't really say much about the different considerations on whether to set up Svelte or SvelteKit through CTA.

However, what I can give some feedback on is that at the moment the way the tauri Quick Start Guide is written with regards to setting up a new app using CTA is pretty confusing.

Right at the top it says:

Note that you do not need to follow the below guides if you use create-tauri-app, but we still recommend reading one (such as the HTML/CSS/JavaScript guide) to understand the setup.

Reading this I checked out the guide on SvelteKit below (there isn't a guide for plain Svelte after all). The above statement somewhat implies that CTA would automate the process explained in the individual setup guides. However, as someone new to Svelte I only knew what the Svelte website tells you in their guide/tutorial, and their guide doesn't even mention how to work with a Svelte project without using SvelteKit.

It took a lot of searching to finally find this very issue, because until then I had no idea why the template CTA created looked completely different than pretty much every resource you can find on Svelte (since the vast majority use SvelteKit).

So, if there are technical considerations as to why CTA doesn't include SvelteKit that's fine by me, I lack the knowledge to judge. However, I think it should be made clear in the documentation that using CTA to scaffold a Svelte-Tauri project requires a completely different approach in terms of project/logical structure than the one the official Svelte tutorial teaches. For someone experienced this might be very obvious, but for a new user the way it is written now is everything but intuitive.

@amrbashir
Copy link
Member

We decided to replace Svelte with SvelteKit in #708

amrbashir added a commit that referenced this issue May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants