smolter
Types

FileRouterOptions

Vite plugin configuration.

Compatibility

ReactServer/build API, not a browser import.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactServer/build API, not a browser import.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.

Import from @kasperrt/smolter/react/vite @kasperrt/smolter/preact/vite

Signature

interface FileRouterOptions {
  directory?: string;
  dataEndpoint?: string;
  clientRoutes?: string;
  serverRoutes?: string;
  framework?: "react" | "preact";
}

Usage

Vite plugin configuration. directory defaults to src/routes. clientRoutes and serverRoutes switch to explicit manual tables and must be supplied together. Paths are resolved relative to the Vite project root.

routerPlugin({
  clientRoutes: "src/manual-browser-routes.ts",
  serverRoutes: "src/manual-routes.ts",
});

Application data endpoint

Data requests use the route pathname plus .__smolter by default, independently of the asset/CDN base. Explicit dataEndpoint retains the legacy ?url= transport and must agree across browser, Vite and production adapters. Reserve the suffix in host routing and apply authentication to document and data requests.

Fields

directory

directory?: string;

dataEndpoint

dataEndpoint?: string;

clientRoutes

clientRoutes?: string;

serverRoutes

serverRoutes?: string;

framework

framework?: "react" | "preact";
View implementation ↗