DEV Community

When to use Svelte vs SvelteKit vs Sapper?

Dana Woodman on April 16, 2021

UPDATE July 15, 2022: At this point, despite SvelteKit not yet being at v1.0, I would highly recommend anyone deciding between SvelteKit and Sapper...
Collapse
 
souksyp profile image
Souk Syp.

I had issue with SvelteKit when importing Faunadb-js*. I switched to Sapper and it worked as expected. Then I tried Next. I didn't look back.... no more Vite's import.meta.env thing and webpack hot reloading is so fast. My app state stays intact while I modify and save files on vscode.

Here's my preferences in 2021:

  • Svelte for Single Page Apps.
  • Next for Server-side web apps (best for SEO)

*Yes, I can use GraphQL but I had already FQL queries in my app. I mean I am too lazy to refactor...

Collapse
 
colinaut profile image
Colin Fahrion

Yep this is exactly where I’m at too. I’d love to use sveltekit/sapper for SSR but I don’t trust it yet and the ecosystem/DX for Next is really good. React itself can be a pain sometimes but the strength of Next makes up for it. For purely static sites these days though I’m all in on Eleventy. Maybe in a year from now it’ll be different when SvelteKit matures, but for me it’s:

  • Svelte for SPA
  • Next for SSR
  • 11ty for SSG
Collapse
 
danawoodman profile image
Dana Woodman

Yeah, Kit is still rough (to be expected being a beta and all), so it isn't for everyone right now. I'll bet this will change rapidly tho.

Next is a great solution if you are happy using React

Collapse
 
danawoodman profile image
Dana Woodman

Next us a great tool, esp if you want to work with React.

You likely had what is (now) a common issue with CommonJS packages, because Vite focuses on ESM (the future). This will likely be resolved soonish. Check the SvelteKit FAQ for the solution 👍

What is the issue with import.meta.env? You can use dotenv too if you want.

I'll wager in a few months most the SvelteKit issues will be in the past.

PS, Vite reloading is faster than Next because of ESM, but Sapper is def slower

Collapse
 
souksyp profile image
Souk Syp. • Edited

No offence I love Svelte as you do (I imagine)

Collapse
 
syedsimanta03 profile image
syedsimanta03

I'm a React dev. This post is pretty simple just what I wanted to know

Collapse
 
avxkim profile image
Alexander Kim

Yeah, svelte kit is for all purposes now, please, update your article.

Collapse
 
danawoodman profile image
Dana Woodman

I make a note in the article 👍

Collapse
 
rawas94 profile image
AbdulRaHman elRawas

Straight to the point. Thanks.

Collapse
 
kalashin1 profile image
Kinanee Samson

Thanks pal, i wanted to start a new project but i have been headaches choosing between Sapper and svelte-kit, I'm a lil bit cleared as to which option to take

Collapse
 
danawoodman profile image
Dana Woodman

At this point, Kit is almost v1.0, so you likely want to use Kit in almost all cases now. I'll update the article