Describe the bug
Since 3.0, svelte-kit sync resolves the Vite config with vite.resolveConfig(..., 'build') (load_vite_config in src/cli.js). During that call, the config hook of the build plugin (src/exports/vite/build/index.js) already runs a full sync:
manifest_data = create_manifest_data(kit, root);
set_manifest_data(manifest_data);
sync.all(kit, root, manifest_data);
sync.all includes write_all_types. After load_vite_config returns, the CLI calls sync.all_types(sveltekit_config, vite_config.root). That builds the manifest and writes all types a second time.
On an app with ~120 route modules, a CPU profile of svelte-kit sync shows ~160–220ms in the plugin's sync and another ~115ms in the CLI's all_types. The whole command takes ~0.8s, so the repeat is about 15% of it. The code is the same on main.
The CLI could skip all_types when the plugin has already synced, or the plugin could skip its sync when the CLI invokes it.
Reproduction
- In any SvelteKit 3 app with a few routes, run:
node --cpu-prof --cpu-prof-dir=prof node_modules/@sveltejs/kit/svelte-kit.js sync
- Open the profile, for example in Chrome DevTools.
create_manifest_data and write_all_types each run twice: once under exports/vite/build/index.js (config handler, via sync.all) and once under cli.js (via sync.all_types).
Logs
No response
System Info
System: macOS 26 (Darwin 25.6.0), Apple Silicon
Node: 24.21.0
@sveltejs/kit: 3.0.0 (the code paths are unchanged on main / 3.0.1)
vite: 8.3.2
svelte: 5.57.2
Severity
annoyance
Additional Information
We run svelte-kit sync before every type check (svelte-kit sync && svelte-check), so the duplicate cost adds up during local development.
Describe the bug
Since 3.0,
svelte-kit syncresolves the Vite config withvite.resolveConfig(..., 'build')(load_vite_configinsrc/cli.js). During that call, theconfighook of the build plugin (src/exports/vite/build/index.js) already runs a full sync:sync.allincludeswrite_all_types. Afterload_vite_configreturns, the CLI callssync.all_types(sveltekit_config, vite_config.root). That builds the manifest and writes all types a second time.On an app with ~120 route modules, a CPU profile of
svelte-kit syncshows ~160–220ms in the plugin's sync and another ~115ms in the CLI'sall_types. The whole command takes ~0.8s, so the repeat is about 15% of it. The code is the same onmain.The CLI could skip
all_typeswhen the plugin has already synced, or the plugin could skip its sync when the CLI invokes it.Reproduction
create_manifest_dataandwrite_all_typeseach run twice: once underexports/vite/build/index.js(confighandler, viasync.all) and once undercli.js(viasync.all_types).Logs
No response
System Info
Severity
annoyance
Additional Information
We run
svelte-kit syncbefore every type check (svelte-kit sync && svelte-check), so the duplicate cost adds up during local development.