DEV Community

Discussion on: When to use Svelte vs SvelteKit vs 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)