JavaScriptDeveloper Tools

SvelteKit 3 RC: Config Moves, $lib Gone, Migrate Now

SvelteKit 3 RC migration guide - Vite 8 required config moves

SvelteKit 3 hit Release Candidate on August 13 with one message from the team: no further breaking changes before stable. That makes right now the window to get your apps ready — not when the stable drops and your team is scrambling.

Start here:

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

That command handles most of the heavy lifting — dependency bumps, config relocation, import rewrites. It generates a TODO list for the things it cannot touch. Run it on a branch, review the diff, work through the list. Everything below explains what you’ll find there.

Three Things That Actually Break

1. Configuration Leaves svelte.config.js

Your kit configuration block moves from svelte.config.js into the sveltekit() Vite plugin call inside vite.config.js. The old file doesn’t disappear entirely, but the options you set there for routing, aliases, and adapter configuration no longer belong there in v3. The migration command moves these automatically — your job is verifying the output, especially if you have custom adapter options or non-standard path configurations.

2. $lib Is Now #lib

Every import { thing } from '$lib/utils' becomes import { thing } from '#lib/utils.ts'. Note the required file extension. Node’s subpath imports require unambiguous paths, so you cannot omit .ts or .js. Add this to your package.json:

{
  "imports": {
    "#lib": "./src/lib/index.js",
    "#lib/*": "./src/lib/*"
  }
}

The migration script rewrites most imports automatically. Where it misses is dynamic imports and any place you’ve constructed import paths as strings. Those appear on the TODO list.

3. $env/* Modules Are Gone

The $env/static/private, $env/dynamic/public, and related modules no longer exist in SvelteKit 3. In their place: a src/env.ts file where you declare exactly which environment variables your app depends on.

import { defineEnvVars } from '@sveltejs/kit';

export const variables = defineEnvVars({
  DATABASE_URL: { secret: true },
  PUBLIC_API_URL: { public: true }
});

Public variables ship to the client with the initial server-rendered HTML. Private ones never leave the server. Build-time resolution enables dead code elimination. The validators only ever run server-side. It is a better system — just a migration cost to pay up front. The sv migrate tool generates the initial env.ts based on your current usage; review it carefully before merging.

Vite 8 Is Now Required

SvelteKit 2 supported Vite 8 as an option. SvelteKit 3 requires it. If your project already runs Vite 8, this is a non-event — the migration script confirms the version and moves on. If you’re still on Vite 7, the migration bumps your dependency and brings Rolldown in as the bundler.

What Rolldown means practically: GitLab’s production build went from two and a half minutes to 22 seconds after the Vite 8 switch. Most SvelteKit projects see 10–50% build time reductions, though the gains shrink if your build time is dominated by Vite plugins like Sentry or image processing rather than the bundler itself. We covered the Vite 8 migration in depth if you want the full picture on Rolldown.

Remote Functions Graduate to First-Class

Remote functions have been experimental since SvelteKit 2.27. Version 3 makes them official alongside load functions. The concept: server-side logic — database calls, secret access, file reads — wrapped in a typed function that your client components call as if it were local. SvelteKit generates the fetch call and TypeScript types between them.

Four types cover the common cases: query for reading data, form for mutations through form elements, command for server actions without a form, and prerender for build-time data generation. The API is cleaner than Next.js Server Actions: no 'use server' directives, no action name strings, just a typed function import. The Register described the approach as “radical” relative to how RPCs are handled in the React ecosystem.

Worth noting: remote functions remain marked experimental in the RC. The API is stable, but the team is reserving the right to refine edge cases before the final release. Use them in new code; hold off migrating critical paths until stable ships.

When Does Stable Drop?

The Svelte team has not announced a date — “near future” is the language in the RC post. Given the “no further breaking changes” guarantee, stable is almost certainly weeks away, not months. Run the migration now on a branch, fix the TODO list, and hold the PR. The official RC announcement is the place to watch for the date, and the migration guide on next.svelte.dev covers every change in detail.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *

    More in:JavaScript