vite-plugin-kit-routes is a Vite plugin for SvelteKit that generates a typed route helper file ($lib/ROUTES) from your file system routes. It provides autocompletion, type safety, and avoids typos by letting you reference routes via a type-safe route() function. The latest stable version is 1.0.3, released as part of the KitQL ecosystem. It requires SvelteKit ^2.4.0 and Vite ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0. Compared to manual route strings or other route generation tools, it integrates directly as a Vite plugin, generates TypeScript types automatically, and updates the route file on save. Release cadence follows monthly updates alongside other KitQL packages.
npm install vite-plugin-kit-routesVerified import paths — ran on the pinned version, not inferred.
Shows how to add the plugin to Vite config and use the generated route function in a SvelteKit component.
Ensure $lib/ROUTES exists after running the plugin. Import route from '$lib/ROUTES'.
Update dependencies: npm install @sveltejs/kit@^2.4.0 vite@^5.0.0
Use named import: import { kitRoutes } from 'vite-plugin-kit-routes'Ensure the plugin is properly added to vite.config and restart the dev server (npm run dev). The file is generated on startup.
Use named import: import { kitRoutes } from 'vite-plugin-kit-routes'. Also check that the package is installed: npm i -D vite-plugin-kit-routesImport route from '$lib/ROUTES' (not from the package). Ensure the plugin is running and the file exists.
Upgrade @sveltejs/kit: npm install @sveltejs/kit@^2.4.0