API βΊ @qwik.dev/qwik-router/ssg
generate
Use this function when SSG should be generated from another module, such as a Vite plugin. This function's should be passed the paths of the entry module and Qwik Router Plan.
export declare function generate(opts: SsgGenerateOptions): Promise<SsgResult>;
Parameter | Type | Description |
|---|---|---|
opts |
Returns:
Promise<SsgResult>
runSsg
Run SSG as a standalone process. Writes _static-paths.json to outDir and exits with code 0 on success, 1 on error.
Intended to be called from a generated run-ssg.js wrapper that provides render/config.
export declare function runSsg(opts: SsgGenerateOptions): Promise<never>;
Parameter | Type | Description |
|---|---|---|
opts |
Returns:
Promise<never>
SsgInternalOptions
Internal SSG options that include the render function and router config.
export interface SsgGenerateOptions extends SsgOptions
Extends: SsgOptions
Property | Modifiers | Type | Description |
|---|---|---|---|
QwikRouterConfig | The Qwik Router Config object (default export from | ||
Render | The SSR render function (default export from entry.ssr). | ||
string | URL | (Optional) Path or URL to the worker entry file. Workers are spawned using this file. When run-ssg.js serves as both main and worker entry, this should be |
SsgOptions
export interface SsgOptions extends SsgRenderOptions
Extends: SsgRenderOptions
Property | Modifiers | Type | Description |
|---|---|---|---|
string | (Optional) Defaults to | ||
string | (Optional) |
SsgRenderOptions
export interface SsgRenderOptions extends RenderOptions
Extends: RenderOptions
Property | Modifiers | Type | Description |
|---|---|---|---|
boolean | (Optional) Set to | ||
boolean | (Optional) Set to | ||
boolean | (Optional) Set to | ||
string[] | (Optional) Defines file system routes relative to the source | ||
string[] | (Optional) Defines file system routes relative to the source | ||
'debug' | (Optional) Log level. | ||
number | (Optional) Maximum number of tasks to be running at one time per worker. Defaults to | ||
number | (Optional) Maximum number of workers to use while generating the static pages. Defaults to the number of CPUs available. | ||
string | The URL The If the site also starts with a pathname other than | ||
string | File system directory where the static files should be written. | ||
string | null | (Optional) File system path to write the |
startWorker
Bootstrap a worker thread for SSG rendering. Called from the generated run-ssg.js when it detects it's running as a worker thread.
export declare function startWorker(
opts: Pick<SsgGenerateOptions, "render" | "qwikRouterConfig">,
): Promise<void>;
Parameter | Type | Description |
|---|---|---|
opts | Pick<SsgGenerateOptions, 'render' | 'qwikRouterConfig'> | Must include |
Returns:
Promise<void>
StaticGenerateResult
export interface SsgResult
Property | Modifiers | Type | Description |
|---|---|---|---|
number | |||
number | |||
number | |||
string[] |