vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
26 lines • 1.43 kB
TypeScript
import type { UserConfig } from "vite";
/** Options for the Storybook preset, passed via the addon entry:
* `addons: [{ name: "vite-plugin-react-server/storybook", options: { rsc: true } }]`.
*/
export interface StorybookPresetOptions {
/**
* Whether the vprs plugin stays active in Storybook (default `true`).
*
* When kept, the RSC dev server runs inside Storybook and Server Components
* stream for real — the `.rsc` / `_rsc` routes are served, so a story's
* `createReactFetcher` can render the live app. No launch flag is needed: the
* plugin sets the `react-server` condition per-environment and the RSC worker
* sets it for itself, so plain `storybook dev` is enough.
*
* Set `rsc: false` to opt OUT — strip the plugin and bundle client components
* only. That's the lighter, no-RSC-worker build for projects that only want
* to story client UI; the preset then re-adds the few resolver/HMR shims the
* stripped plugin would otherwise have provided.
*/
rsc?: boolean;
}
/** Storybook `viteFinal` preset hook. Storybook merges the addon's registered
* `options` into the options object, so `options.rsc` is the flag set via
* `addons: [{ name: "…/storybook", options: { rsc: true } }]`. */
export declare const viteFinal: (config: UserConfig, options?: StorybookPresetOptions) => Promise<UserConfig>;
//# sourceMappingURL=preset.d.ts.map