configureApplication
Configure deployment-specific URL and document navigation behavior before mounting a Preact application.
Compatibility
Import from @kasperrt/smolter/react/client @kasperrt/smolter/preact/client
Signature
function configureApplication(
environment: ApplicationEnvironment,
): void;Parameters
Accepts one ApplicationEnvironment object. Fields may be omitted. resolveURL maps a destination before application navigation; isDocumentHandoff selects document links for a custom handoff; leaveDocument performs external navigation; entryScript supplies the source rendered by Scripts.
Returns and lifetime
Returns void. Each call replaces the entire configuration rather than merging fields. Call configureApplication({}) to restore defaults. The configuration is module-scoped, so do not set request-specific server data here.
Usage
Configure only the deployment behavior your application needs, then mount it. The route list remains the source of route matching and loader/action registration.
import { defineRoute } from "@kasperrt/smolter/preact";
import { configureApplication, mountApplication } from "@kasperrt/smolter/preact/client";
import * as home from "./routes/_index/route";
configureApplication({
isDocumentHandoff: (from, to) =>
from.origin !== to.origin && to.origin === "https://account.example",
});
const routes = [defineRoute("/", home)];
await mountApplication(routes);