vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
31 lines • 1.25 kB
TypeScript
/**
* Deferred Static Generation
*
* When using Vite's Environment API (buildApp), static generation must run
* AFTER all environments (client, ssr, server) have completed their builds.
*
* This module provides a mechanism to defer static generation:
* 1. Client's closeBundle stores the generation function instead of executing it
* 2. The buildApp hook calls runDeferredStaticGeneration() after all builds complete
*
* This solves the build order problem where client's closeBundle runs before
* the server environment builds, making the server manifest unavailable.
*/
/**
* Store a static generation function to be called later by buildApp.
*/
export declare function deferStaticGeneration(fn: () => Promise<void>): void;
/**
* Run the deferred static generation function (called by buildApp after all builds).
* Returns false if no function was deferred.
*/
export declare function runDeferredStaticGeneration(): Promise<boolean>;
/**
* Check if there's a deferred static generation pending.
*/
export declare function hasDeferredStaticGeneration(): boolean;
/**
* Reset state (for test isolation).
*/
export declare function resetDeferredStaticGeneration(): void;
//# sourceMappingURL=deferredStaticGeneration.d.ts.map