API › @qwik.dev/qwik/optimizer
BundleGraphAdder
A function that returns a map of bundle names to their dependencies.
export type BundleGraphAdder = (manifest: QwikManifest) => Record<
string,
{
imports?: string[];
dynamicImports?: string[];
}
>;
References: QwikManifest
enableRequestRewrite
ExperimentalFeatures
Use __EXPERIMENTAL__.x to check if feature x is enabled. It will be replaced with true or false via an exact string replacement.
Add experimental features to this enum definition.
export declare enum ExperimentalFeatures
Member | Value | Description |
|---|---|---|
enableRequestRewrite |
| Enable request.rewrite() |
insights |
| Enable the ability to use the Qwik Insights vite plugin and |
noSPA |
| Disable SPA navigation handler in Qwik Router |
preventNavigate |
| Enable the usePreventNavigate hook |
valibot |
| Enable the Valibot form validation |
webWorker |
| Enable worker$ |
GlobalInjections
export interface GlobalInjections
Property | Modifiers | Type | Description |
|---|---|---|---|
{ [key: string]: string; } | (Optional) | ||
'head' | 'body' | |||
string |
insights
noSPA
preventNavigate
QwikAsset
export interface QwikAsset
Property | Modifiers | Type | Description |
|---|---|---|---|
string | undefined | Name of the asset | ||
number | Size of the asset |
QwikBuildMode
export type QwikBuildMode = "production" | "development";
QwikBuildTarget
export type QwikBuildTarget = "client" | "ssr" | "lib" | "test";
QwikBundle
export interface QwikBundle
Property | Modifiers | Type | Description |
|---|---|---|---|
string[] | (Optional) Dynamic imports | ||
string[] | (Optional) Direct imports | ||
number | (Optional) Interactivity score of the bundle | ||
string[] | (Optional) Source files of the bundle | ||
number | Size of the bundle | ||
string[] | (Optional) Symbols in the bundle | ||
number | Total size of this bundle's static import graph |
QwikBundleGraph
Bundle graph.
Format: [ 'bundle-a.js', 3, 5 // Depends on 'bundle-b.js' and 'bundle-c.js' 'bundle-b.js', 5, // Depends on 'bundle-c.js' 'bundle-c.js', ]
export type QwikBundleGraph = Array<string | number>;
QwikManifest
The metadata of the build. One of its uses is storing where QRL symbols are located.
export interface QwikManifest
Property | Modifiers | Type | Description |
|---|---|---|---|
{ [fileName: string]: QwikAsset; } | (Optional) All assets. The key is the fileName relative to the rootDir | ||
(Optional) All bundles in a compact graph format with probabilities | |||
string | (Optional) The bundle graph fileName | ||
{ [fileName: string]: QwikBundle; } | All code bundles, used to know the import graph. The key is the bundle fileName relative to "build/" | ||
string | (Optional) The Qwik core bundle fileName | ||
(Optional) CSS etc to inject in the document head | |||
string | Content hash of the manifest, if this changes, the code changed | ||
{ [symbolName: string]: string; } | Where QRLs are located. The key is the symbol name, the value is the bundle fileName | ||
{ target?: string; buildMode?: string; entryStrategy?: { type: EntryStrategy['type']; }; } | (Optional) The options used to build the manifest | ||
{ [name: string]: string; } | (Optional) The platform used to build the manifest | ||
string | (Optional) The preloader bundle fileName | ||
string | (Optional) The Qwik loader bundle fileName | ||
{ [symbolName: string]: QwikSymbol; } | QRL symbols | ||
string | The version of the manifest |
qwikRollup
export declare function qwikRollup(
qwikRollupOpts?: QwikRollupPluginOptions,
): any;
Parameter | Type | Description |
|---|---|---|
qwikRollupOpts | (Optional) |
Returns:
any
QwikRollupPluginOptions
export interface QwikRollupPluginOptions
Property | Modifiers | Type | Description |
|---|---|---|---|
(Optional) Build Default | |||
boolean | (Optional) | ||
boolean | (Optional) Prints verbose Qwik plugin debug logs. Default | ||
EntryStrategy | (Optional) The Qwik entry strategy to use while building for production. During development the type is always Default | ||
(keyof typeof ExperimentalFeatures)[] | (Optional) Experimental features. These can come and go in patch releases, and their API is not guaranteed to be stable between releases. | ||
boolean | (Optional) Run eslint on the source files for the ssr build or dev server. This can slow down startup on large projects. Defaults to | ||
(Optional) The SSR build requires the manifest generated during the client build. The Default | |||
(manifest: QwikManifest) => Promise<void> | void | (Optional) The client build will create a manifest and this hook is called with the generated build data. Default | ||
OptimizerOptions | (Optional) | ||
string | (Optional) The root of the application, which is commonly the same directory as Default | ||
string | (Optional) The source directory to find all the Qwik components. Since Qwik does not have a single input, the Default | ||
TransformModuleInput[] | null | (Optional) Alternative to Default: | ||
(Optional) Target Default | |||
((transformedModules: TransformModule[]) => Promise<void> | void) | null | (Optional) Hook that's called after the build and provides all of the transformed modules that were used before bundling. |
QwikSymbol
export interface QwikSymbol
Property | Modifiers | Type | Description |
|---|---|---|---|
string | |||
string[] | (Optional) The transformed names of scoped variables, if any | ||
boolean | Whether the symbol captures a variable | ||
'function' | 'eventHandler' | |||
string | |||
string | |||
string | |||
[number, number] | |||
string | |||
string[] | (Optional) The parameter names if it's a function with parameters | ||
string | null |
qwikVite
The types for Vite/Rollup don't allow us to be too specific about the return type. The correct return type is [QwikVitePlugin, VitePlugin<never>], and if you search the plugin by name you'll get the QwikVitePlugin.
export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;
Parameter | Type | Description |
|---|---|---|
qwikViteOpts | (Optional) |
Returns:
any
QwikVitePlugin
This is the type of the "pre" Qwik Vite plugin. qwikVite actually returns a tuple of two plugins, but after Vite flattens them, you can find the plugin by name.
export type QwikVitePlugin = P<QwikVitePluginApi> & {
name: "vite-plugin-qwik";
};
References: QwikVitePluginApi
QwikVitePluginApi
export interface QwikVitePluginApi
Property | Modifiers | Type | Description |
|---|---|---|---|
() => string | undefined | |||
() => string | null | |||
() => string | null | |||
() => QwikManifest | null | |||
() => Optimizer | null | |||
() => NormalizedQwikPluginOptions | |||
() => string | null | |||
(adder: BundleGraphAdder) => void |
QwikVitePluginOptions
export type QwikVitePluginOptions =
| QwikVitePluginCSROptions
| QwikVitePluginSSROptions;
ResolvedManifest
export interface ResolvedManifest
Property | Modifiers | Type | Description |
|---|---|---|---|
(Optional) | |||
(Optional) | |||
ServerQwikManifest
The manifest values that are needed for SSR.
export type ServerQwikManifest = Pick<
QwikManifest,
| "manifestHash"
| "injections"
| "bundleGraph"
| "bundleGraphAsset"
| "mapping"
| "preloader"
| "core"
| "qwikLoader"
>;
References: QwikManifest
SymbolMapper
export type SymbolMapper = Record<
string,
readonly [symbol: string, chunk: string]
>;
SymbolMapperFn
export type SymbolMapperFn = (
symbolName: string,
mapper: SymbolMapper | undefined,
parent?: string,
) => readonly [symbol: string, chunk: string] | undefined;
References: SymbolMapper