Skip to main content

Function: runStaticExport()

runStaticExport(serverOptions, exportOptions?): Promise<StaticExportResult>

Defined in: static.ts:352

Convenience wrapper: starts a real Server instance, crawls it with exportStaticSite(), then stops it. Does not destroy serverOptions.objectFactory — the caller created it and owns its lifecycle (call objectFactory.destroy() after this resolves), matching the Server/ObjectFactory ownership split used elsewhere in this codebase.

Sets STATIC_EXPORT_ENV_VAR for the lifetime of the server it starts, activating each ReactRoute's static-path-enumeration endpoint on it — the server this function boots is always a short-lived, export-only instance, never the app's real deployment, so this is the one place that flag is safe to set. Restored afterward (not just left set) in case the calling process goes on to do other things — e.g. a test suite invoking this repeatedly, or a host embedding export as one step alongside others.

Parameters​

serverOptions​

ServerOptions

exportOptions?​

Omit<StaticExportOptions, "port"> = {}

Returns​

Promise<StaticExportResult>