learn.svelte.dev icon indicating copy to clipboard operation
learn.svelte.dev copied to clipboard

Is the Svelte Kit tutorial updated for v2?

Open samzmann opened this issue 2 years ago • 1 comments

I'm going throught the tutorial and enjoying it. Great work! Now I just got the the Part 3 / Loading data / Page data section. I got curious about how error works so I consulted the docs, only to find that apparently in SvelteKit V2 I don't need to use throw:

import { error } from '@sveltejs/kit'

- throw error(500, 'something went wrong');
+ error(500, 'something went wrong');

See:

  • https://kit.svelte.dev/docs/errors
  • https://kit.svelte.dev/docs/migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you

This got me wondering: why is the tutorial teaching me SvelteKit V1? Is this intentional, or did we forget to update the tutorial to V2..?

So I just wanted to ask/bring this to your attention.

Other than that, keep up the nice work!

samzmann avatar Dec 15 '23 14:12 samzmann

It's not updated, if you look at package.json it's using sveltejs/kit@^1.30.3 I forked it to update it but it's not straight forward, sveltekit 2 requires sveltejs/vite-plugin-svelte package, but when you install it the dev mode breaks. build & preview work but the lesson dropdown selector stops working for some reason (all the options disappear). I don't want to update the tutorial code if I can't setup the environment without breaking anything first. maybe a maintainer with a better knowledge of the code base could tackle this update

AdelBeit avatar May 09 '24 05:05 AdelBeit