packages/docs/src/routes/api/qwik-server/index.mdx
Provides the qwikloader.js file as a string. Useful for tooling to inline the qwikloader script into HTML.
export declare function getQwikLoaderScript(opts?: { debug?: boolean }): string;
Parameter
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td>opts
</td><td>{ debug?: boolean; }
</td><td>(Optional)
</td></tr> </tbody></table>Returns:
string
<h2 id="getqwikprefetchworkerscript">getQwikPrefetchWorkerScript</h2>Provides the qwik-prefetch-service-worker.js file as a string. Useful for tooling to inline the qwik-prefetch-service-worker script into HTML.
export declare function getQwikPrefetchWorkerScript(opts?: {
debug?: boolean;
}): string;
Parameter
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td>opts
</td><td>{ debug?: boolean; }
</td><td>(Optional)
</td></tr> </tbody></table>Returns:
string
<h2 id="inorderauto">InOrderAuto</h2>export interface InOrderAuto
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>number
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>number
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>'auto'
</td><td> </td></tr> </tbody></table> <h2 id="inorderdisabled">InOrderDisabled</h2>export interface InOrderDisabled
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>'disabled'
</td><td> </td></tr> </tbody></table> <h2 id="inorderstreaming">InOrderStreaming</h2>export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
References: InOrderAuto, InOrderDisabled
<h2 id="prefetchimplementation">PrefetchImplementation</h2>Warning: This API is now obsolete.
Use
preloaderinstead
export interface PrefetchImplementation
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>'auto' | 'low' | 'high' | null
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>'js-append' | 'html-append' | null
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>'prefetch' | 'preload' | 'modulepreload' | null
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>'always' | null
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>'always' | 'no-link-support' | null
</td><td>(Optional)
</td></tr> </tbody></table> <h2 id="prefetchresource">PrefetchResource</h2>export interface PrefetchResource
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td>string
</td><td> </td></tr> </tbody></table> <h2 id="prefetchstrategy">PrefetchStrategy</h2>export interface PrefetchStrategy
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td> </td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td> </td><td>(Optional)
</td></tr> </tbody></table> <h2 id="preloaderoptions">PreloaderOptions</h2>export interface PreloaderOptions
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>boolean
</td><td>(Optional) Log preloader debug information to the console.
Defaults to false
number
</td><td>(Optional) Maximum number of simultaneous preload links that the preloader will maintain. If you set this higher, the browser will have all JS files in memory sooner, but it will contend with other resource downloads. Furthermore, if a bundle suddenly becomes more likely, it will have to wait longer to be preloaded.
Bundles that reach 100% probability (static imports of other bundles) will always be preloaded immediately, no limit.
Defaults to 25
number
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>number
</td><td>(Optional) The minimum probability for a bundle to be added as a preload link during SSR.
Defaults to 0.7 (70% probability)
This makes sure that the most likely bundles are preloaded ahead of time.
</td></tr> <tr><td> </td><td> </td><td>number
</td><td>(Optional) Maximum number of preload links to add during SSR. These instruct the browser to preload likely bundles before the preloader script is active. This most likely includes the core and the preloader script itself. Setting this to 0 will disable all preload links.
Preload links can delay LCP, which is a Core Web Vital, but it can increase TTI, which is not a Core Web Vital but more noticeable to the user.
Defaults to 5
export type QwikLoaderOptions =
| "module"
| "inline"
| "never"
| {
include?: "always" | "never" | "auto";
position?: "top" | "bottom";
};
export type Render = RenderToString | RenderToStream;
References: RenderToString, RenderToStream
<h2 id="renderoptions">RenderOptions</h2>export interface RenderOptions extends SerializeDocumentOptions
Extends: SerializeDocumentOptions
<table><thead><tr><th>Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>string | ((options: RenderOptions) => string)
</td><td>(Optional) Specifies the root of the JS files of the client build. Setting a base, will cause the render of the q:base attribute in the q:container element.
Record<string, string>
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>string
</td><td>(Optional) When set, the app is serialized into a fragment. And the returned html is not a complete document. Defaults to html
string | ((options: RenderOptions) => string)
</td><td>(Optional) Language to use when rendering the document.
</td></tr> <tr><td> </td><td> </td><td>PrefetchStrategy | null
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>PreloaderOptions | false
</td><td>(Optional) Specifies how preloading is handled. This ensures that code is instantly available when needed.
</td></tr> <tr><td> </td><td> </td><td> </td><td>(Optional) Specifies how the Qwik Loader is included in the document. This enables interactivity and lazy loading.
module: Use a <script> tag to load the Qwik Loader. Subsequent page loads will have the script cached and instantly running.
inline: This embeds the Qwik Loader script directly in the document. This adds about 3kB before compression, which typically is reduced to about 1.6kB with gzip.
never: Do not include the Qwik Loader script. This is mostly useful when embedding multiple containers on the same page.
Defaults to module.
Note that the Qwik Loader is absolutely required for Qwik to work. There must be an instance of it loaded for any interactivity to happen.
</td></tr> <tr><td> </td><td> </td><td>QwikPrefetchServiceWorkerOptions
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>Record<string, any>
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>boolean
</td><td>(Optional) Defaults to true
export interface RenderResult
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>boolean
</td><td> </td></tr> <tr><td> </td><td> </td><td>ServerQwikManifest
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td>SnapshotResult | undefined
</td><td> </td></tr> </tbody></table> <h2 id="rendertostream-function">renderToStream</h2>export type RenderToStream = (
opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;
References: RenderToStreamOptions, RenderToStreamResult
<h2 id="rendertostream-type-alias">RenderToStream</h2>export type RenderToStream = (
opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;
References: RenderToStreamOptions, RenderToStreamResult
<h2 id="rendertostreamoptions">RenderToStreamOptions</h2>export interface RenderToStreamOptions extends RenderOptions
Extends: RenderOptions
<table><thead><tr><th>Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>StreamWriter
</td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td>(Optional)
</td></tr> </tbody></table> <h2 id="rendertostreamresult">RenderToStreamResult</h2>export interface RenderToStreamResult extends RenderResult
Extends: RenderResult
<table><thead><tr><th>Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>number
</td><td> </td></tr> <tr><td> </td><td> </td><td>number
</td><td> </td></tr> <tr><td> </td><td> </td><td>{ firstFlush: number; render: number; snapshot: number; }
</td><td> </td></tr> </tbody></table> <h2 id="rendertostring-function">renderToString</h2>export type RenderToString = (
opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;
References: RenderToStringOptions, RenderToStringResult
<h2 id="rendertostring-type-alias">RenderToString</h2>export type RenderToString = (
opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;
References: RenderToStringOptions, RenderToStringResult
<h2 id="rendertostringoptions">RenderToStringOptions</h2>export interface RenderToStringOptions extends RenderOptions
Extends: RenderOptions
<h2 id="rendertostringresult">RenderToStringResult</h2>export interface RenderToStringResult extends RenderResult
Extends: RenderResult
<table><thead><tr><th>Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>string
</td><td> </td></tr> <tr><td> </td><td> </td><td>{ render: number; snapshot: number; }
</td><td> </td></tr> </tbody></table> <h2 id="resolvemanifest">resolveManifest</h2>Merges a given manifest with the built manifest and provides mappings for symbols.
export declare function resolveManifest(
manifest?: Partial<QwikManifest | ResolvedManifest> | undefined,
): ResolvedManifest | undefined;
Parameter
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td>manifest
</td><td>Partial<QwikManifest | ResolvedManifest> | undefined
</td><td>(Optional)
</td></tr> </tbody></table>Returns:
ResolvedManifest | undefined
<h2 id="serializedocumentoptions">SerializeDocumentOptions</h2>export interface SerializeDocumentOptions
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>boolean
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>Partial<QwikManifest | ResolvedManifest>
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>SymbolMapperFn
</td><td>(Optional)
</td></tr> </tbody></table> <h2 id="setserverplatform">setServerPlatform</h2>export declare function setServerPlatform(
manifest?: Partial<QwikManifest | ResolvedManifest>,
): Promise<void>;
Parameter
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td>manifest
</td><td>Partial<QwikManifest | ResolvedManifest>
</td><td>(Optional)
</td></tr> </tbody></table>Returns:
Promise<void>
<h2 id="streamingoptions">StreamingOptions</h2>export interface StreamingOptions
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td> </td><td>(Optional)
</td></tr> </tbody></table> <h2 id="symbolstoprefetch">SymbolsToPrefetch</h2>Auto: Prefetch all possible QRLs used by the document. Default
export type SymbolsToPrefetch =
| "auto"
| ((opts: { manifest: ServerQwikManifest }) => PrefetchResource[]);
References: PrefetchResource
<h2 id="versions">versions</h2>versions: {
readonly qwik: string;
readonly qwikDom: string;
}