Litestar Vite connects the Litestar Python backend to a Vite frontend toolchain. Current stable version is 0.22.1, with monthly releases. It supports SPA, Template, Inertia v2/v3, and framework-mode (Astro, Nuxt, SvelteKit) workflows. Key differentiators: one-port dev by proxying Vite through Litestar, optional type generation via OpenAPI/Inertia metadata, and a CLI for asset scaffolding. Peer dependency on Vite 7 or 8. Ships TypeScript types.
npm install litestar-vite-pluginVerified import paths — ran on the pinned version, not inferred.
Shows minimal Litestar app with Vite plugin, including backend setup, plugin config, and CLI commands for scaffolding and running.
Use import { resolvePageComponent } from 'litestar-vite-plugin/inertia'.Use ES import syntax or dynamic import().
Upgrade Vite to version 7 or 8.
Use mode='framework' instead.
Add future: { useScriptElementForInitialPage: true } to Inertia createInertiaApp options, or set InertiaConfig(use_script_element=False) in Python config.Set ViteConfig(asset_url='/static/') and ensure Vite build base matches.
Set environment variable VITE_PROXY_MODE=direct to bypass proxy.
Change to ES module import: import litestarVitePlugin from 'litestar-vite-plugin'; or use dynamic import().
Use named import: import { ViteConfig } from 'litestar-vite-plugin'.Upgrade to litestar-vite-plugin@^0.21 and use import { resolvePageComponent } from 'litestar-vite-plugin/inertia'.Set base in vite.config.ts to match Litestar's asset_url, e.g., base: '/static/'.