sveltejs/kit · error · Error

${file} is no longer used. Please pass configuration via the

Error message

${file} is no longer used. Please pass configuration via the `sveltekit(...)` plugin in your Vite config.

What it means

This version of SvelteKit expects configuration via the `sveltekit(...)` Vite plugin options rather than a `svelte.config.js`/`svelte.config.ts` file in the project root. If such a file exists, the pre-plugin throws immediately to prevent silently ignored configuration.

Source

Thrown at packages/kit/src/exports/vite/index.js:289

	/** @type {string} the `__sveltekit_xxx` name, without `globalThis.` */
	let global_name;

	/** @type {string} name for `globalThis.__sveltekit_xxx` */
	let kit_global;

	/** @type {Plugin} */
	const plugin_resolve_root = {
		name: 'vite-plugin-sveltekit-resolve-root',
		// make sure it runs first
		enforce: 'pre',
		config: {
			order: 'pre',
			handler(config) {
				root = resolve_root(config);

				for (const file of ['svelte.config.js', 'svelte.config.ts']) {
					if (fs.existsSync(path.join(root, file))) {
						throw new Error(
							`${file} is no longer used. Please pass configuration via the \`sveltekit(...)\` plugin in your Vite config.`
						);
					}
				}
			}
		}
	};

	/** @type {Plugin} */
	const plugin_setup = {
		name: 'vite-plugin-sveltekit-setup',
		api: {
			options: svelte_config
		},
		resolveId: {
			filter: { id: removed_modules.map(({ pattern }) => pattern) },
			async handler(id, importer, options) {
				const resolved = await this.resolve(id, importer, { ...options, skipSelf: true });

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Delete or rename `svelte.config.js`/`svelte.config.ts` from the project root
  2. Move its contents into the options object of the `sveltekit(options)` plugin call in `vite.config`
  3. Update tooling/docs that referenced the old config file
  4. Check team scaffolding templates that still generate the file

Example fix

// before (vite.config.js + svelte.config.js in root)
export default defineConfig({ plugins: [sveltekit()] });
// after
import { sveltekit } from '@sveltejs/kit/vite';
export default defineConfig({
  plugins: [sveltekit({ adapter: adapter(), files: { routes: 'src/routes' } })]
});
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
for (const f of ['svelte.config.js', 'svelte.config.ts']) {
  if (existsSync(f)) throw new Error(`${f} must be migrated into the sveltekit() plugin options`);
}

Try / catch

try {
  await viteDevServer.listen();
} catch (err) {
  if (/is no longer used/.test(err.message)) {
    console.error('Move svelte.config.js contents into sveltekit() plugin options');
  }
  throw err;
}

Prevention

When it happens

Trigger: Having `svelte.config.js` or `svelte.config.ts` in the Vite root directory while running `vite dev`/`vite build` with the current SvelteKit Vite plugin.

Common situations: Migrating an older SvelteKit project (or one from the pre-1.0/plugin-based layout) to the plugin-options configuration style; copying a svelte.config.js from an unrelated Svelte project; scaffolding tools that still emit svelte.config.js.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/67e05dd48d9bb232. Report an issue: GitHub.