UNPKG

rsbuild-plugin-react-router

Version:
40 lines (39 loc) 1.34 kB
import type { ServerBuild } from 'react-router'; import type { Route } from './types.js'; /** * Generates the server build template string. * * Note: Federation mode used to require async `import()` wrappers for entrypoints. * With Rspack/@module-federation support for `experiments.asyncStartup`, the * server build can always use static imports. */ interface ServerBuildOptions { entryServerPath: string; assetsBuildDirectory: string; basename: string; appDirectory: string; ssr: boolean; future?: unknown; allowedActionOrigins?: string[]; prerender?: string[]; publicPath?: string; serverManifestId?: string; routeDiscovery: { mode: 'lazy'; manifestPath?: string; } | { mode: 'initial'; } | undefined; } /** * Generates the server build module content * @param routes The route manifest * @param options Build options * @returns The generated module content as a string */ declare function generateServerBuild(routes: Record<string, Route>, options: ServerBuildOptions & { federation?: boolean; }): string; export declare function resolveServerBuildModule(buildModule: unknown, source: string): Promise<ServerBuild>; export declare function resolveReactRouterServerBuild(buildModule: unknown): Promise<ServerBuild>; export { generateServerBuild };