Menu

SvelteKit 3: The Breaking Changes Your Migration Script Won't Catch
πŸ“°

SvelteKit 3: The Breaking Changes Your Migration Script Won't Catch

DEV Community: typescriptΒ·Danny HolloranΒ·6 days ago
#sqW4Fojz
#devtotypescript#devto#dev#lib#error
Long article (921 words) β€” no AI summary yet.
Reading 0:00
15s threshold

SvelteKit 3 shipped on October 1st, and the upgrade path is about as smooth as a major version gets. One command does most of the work:

npx sv migrate sveltekit-3 --tasks all --confirm

Enter fullscreen mode

Exit fullscreen mode

It moves your config from svelte.config.js into the sveltekit() plugin in vite.config.ts , rewrites $lib imports to #lib subpath imports, swaps $app/stores for $app/state , and leaves a TODO list for whatever it couldn't handle. Run it, fix the TODOs, get a green svelte-check , ship.

The catch is that the riskiest changes in the migration guide aren't renames. They're behavior changes. Your code still compiles, your types still pass, and your app now does something different at runtime. A codemod can't flag those because there's nothing syntactically wrong. Here are the ones worth auditing by hand.

Your error hook just got a lot louder

In SvelteKit 2, handleError only ran for unexpected errors. If you threw error(404, 'Not found') from a load function, the hook never saw it.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.