smolter
API

applicationPlugins

Install the optional Preact application Vite integration.

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

function applicationPlugins(options: ApplicationOptions = {}): Plugin[];

Parameters

directory defaults to src/routes; ssr defaults to true; splitRoutes defaults to true. resourceRequest identifies resource URLs that need server handling without an HTML Accept header.

Returns

Returns a Plugin array including flat route discovery, server export filtering, Preact aliases, lazy routes and development HTTP handling.

Usage

Install the optional Preact application Vite integration.

export default defineConfig({
  plugins: applicationPlugins({ directory: "src/routes" }),
});

Behavior and limits

The default SSR integration loads src/entry.server.tsx and starts src/entry.client.tsx. ssr: false supports browser-only apps. See the virtual routes guide; these plugins do not create a production Express server.

Renderer selection

Import applicationPlugins from react/vite or preact/vite. The React entry selects React without compatibility aliases; the Preact entry retains its Preact configuration. Both support SSR middleware, app-scoped transport, lazy file routes and route changes during development.

import { applicationPlugins } from "@kasperrt/smolter/react/vite";

export default { plugins: applicationPlugins() };
View implementation ↗