# [API](/api/) › @qwik.dev/qwik/optimizer

## blockSSR

## BundleGraphAdder

A function that returns a map of bundle names to their dependencies.

```typescript
export type BundleGraphAdder = (manifest: QwikManifest) => Record<
  string,
  {
    imports?: string[];
    dynamicImports?: string[];
  }
>;
```

**References:** [QwikManifest](#qwikmanifest)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/bundle-graph.ts)

## each

## 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.

```typescript
export declare enum ExperimentalFeatures
```

| Member | Value | Description |
| --- | --- | --- |
| blockSSR | `"blockSSR"` | Enable the `blockSSR: false` route loader option |
| each | `"each"` | Enable the Each keyed-list primitive |
| insights | `"insights"` | Enable the ability to use the Qwik Insights vite plugin and `` component |
| noSPA | `"noSPA"` | Disable SPA navigation handler in Qwik Router |
| show | `"show"` | Enable the Show conditional primitive |
| suspense | `"suspense"` | Enable the Suspense fallback primitive |
| valibot | `"valibot"` | Enable the Valibot form validation |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/plugin.ts)

## GlobalInjections

```typescript
export interface GlobalInjections
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| attributes? |  | \{ [key: string]: string; } | _(Optional)_ |
| location |  | 'head' \\| 'body' |  |
| tag |  | string |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## insights

## noSPA

## QwikAsset

```typescript
export interface QwikAsset
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| name |  | string \\| undefined | Name of the asset |
| size |  | number | Size of the asset |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## QwikBuildMode

```typescript
export type QwikBuildMode = "production" | "development";
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/plugin.ts)

## QwikBuildTarget

```typescript
export type QwikBuildTarget = "client" | "ssr" | "lib" | "test";
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/plugin.ts)

## QwikBundle

```typescript
export interface QwikBundle
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| dynamicImports? |  | string[] | _(Optional)_ Dynamic imports |
| imports? |  | string[] | _(Optional)_ Direct imports |
| interactivity? |  | number | _(Optional)_ Interactivity score of the bundle |
| origins? |  | string[] | _(Optional)_ Source files of the bundle |
| size |  | number | Size of the bundle |
| symbols? |  | string[] | _(Optional)_ Symbols in the bundle |
| total |  | number | Total size of this bundle's static import graph |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## 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', ]

```typescript
export type QwikBundleGraph = Array<string | number>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## QwikManifest

The metadata of the build. One of its uses is storing where QRL symbols are located.

```typescript
export interface QwikManifest
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| assets? |  | \{ [fileName: string]: [QwikAsset](#qwikasset); } | _(Optional)_ All assets. The key is the fileName relative to the rootDir |
| bundleGraph? |  | [QwikBundleGraph](#qwikbundlegraph) | _(Optional)_ All bundles in a compact graph format with probabilities |
| bundleGraphAsset? |  | string | _(Optional)_ The bundle graph fileName |
| bundles |  | \{ [fileName: string]: [QwikBundle](#qwikbundle); } | All code bundles, used to know the import graph. The key is the bundle fileName relative to "build/" |
| core? |  | string | _(Optional)_ The Qwik core bundle fileName |
| injections? |  | [GlobalInjections](#globalinjections)[] | _(Optional)_ CSS etc to inject in the document head |
| manifestHash |  | string | Content hash of the manifest, if this changes, the code changed |
| mapping |  | \{ [symbolName: string]: string; } | Where QRLs are located. The key is the symbol name, the value is the bundle fileName |
| options? |  | \{ target?: string; buildMode?: string; entryStrategy?: \{ type: EntryStrategy['type']; }; } | _(Optional)_ The options used to build the manifest |
| platform? |  | \{ [name: string]: string; } | _(Optional)_ The platform used to build the manifest |
| preloader? |  | string | _(Optional)_ The preloader bundle fileName |
| qwikLoader? |  | string | _(Optional)_ The Qwik loader bundle fileName |
| symbols |  | \{ [symbolName: string]: [QwikSymbol](#qwiksymbol); } | QRL symbols |
| version |  | string | The version of the manifest |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## qwikRollup

```typescript
export declare function qwikRollup(
  qwikRollupOpts?: QwikRollupPluginOptions,
): any;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qwikRollupOpts | [QwikRollupPluginOptions](#qwikrolluppluginoptions) | _(Optional)_ |

**Returns:**

any

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/rollup.ts)

## QwikRollupPluginOptions

```typescript
export interface QwikRollupPluginOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| buildMode? |  | [QwikBuildMode](#qwikbuildmode) | _(Optional)_ Build `production` or `development`. Default `development` |
| csr? |  | boolean | _(Optional)_ |
| debug? |  | boolean | _(Optional)_ Prints verbose Qwik plugin debug logs. Default `false` |
| entryStrategy? |  | EntryStrategy | _(Optional)_ The Qwik entry strategy to use while building for production. During development the type is always `segment`. Default `{ type: "smart" }`) |
| experimental? |  | (keyof typeof [ExperimentalFeatures](#experimentalfeatures))[] | _(Optional)_ Experimental features. These can come and go in patch releases, and their API is not guaranteed to be stable between releases. |
| lint? |  | 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 `true` |
| manifestInput? |  | [QwikManifest](#qwikmanifest) | _(Optional)_ The SSR build requires the manifest generated during the client build. The `manifestInput` option can be used to manually provide a manifest. Default `undefined` |
| manifestOutput? |  | (manifest: [QwikManifest](#qwikmanifest)) => Promise<void> \\| void | _(Optional)_ The client build will create a manifest and this hook is called with the generated build data. Default `undefined` |
| optimizerOptions? |  | OptimizerOptions | _(Optional)_ |
| rootDir? |  | string | _(Optional)_ The root of the application, which is commonly the same directory as `package.json` and `rollup.config.js`. Default `process.cwd()` |
| srcDir? |  | string | _(Optional)_ The source directory to find all the Qwik components. Since Qwik does not have a single input, the `srcDir` is used to recursively find Qwik files. Default `src` |
| srcInputs? |  | TransformModuleInput[] \\| null | _(Optional)_ Alternative to `srcDir`, where `srcInputs` is able to provide the files manually. This option is useful for an environment without a file system, such as a webworker. Default: `null` |
| target? |  | [QwikBuildTarget](#qwikbuildtarget) | _(Optional)_ Target `client` or `ssr`. Default `client` |
| transformedModuleOutput? |  | ((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. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/rollup.ts)

## QwikSymbol

```typescript
export interface QwikSymbol
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| canonicalFilename |  | string |  |
| captureNames? |  | string[] | _(Optional)_ The transformed names of scoped variables, if any |
| captures |  | boolean | Whether the symbol captures a variable |
| ctxKind |  | 'function' \\| 'eventHandler' |  |
| ctxName |  | string |  |
| displayName |  | string |  |
| hash |  | string |  |
| loc |  | [number, number] |  |
| origin |  | string |  |
| paramNames? |  | string[] | _(Optional)_ The parameter names if it's a function with parameters |
| parent |  | string \\| null |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## 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`.

```typescript
export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qwikViteOpts | [QwikVitePluginOptions](#qwikvitepluginoptions) | _(Optional)_ |

**Returns:**

any

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/vite.ts)

## 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.

```typescript
export type QwikVitePlugin = P<QwikVitePluginApi> & {
  name: "vite-plugin-qwik";
};
```

**References:** [QwikVitePluginApi](#qwikvitepluginapi)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/vite.ts)

## QwikVitePluginApi

```typescript
export interface QwikVitePluginApi
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| getClientOutDir |  | () => string \\| null |  |
| getClientPublicOutDir |  | () => string \\| null |  |
| getManifest |  | () => [QwikManifest](#qwikmanifest) \\| null |  |
| getOptimizer |  | () => Optimizer \\| null |  |
| getOptions |  | () => NormalizedQwikPluginOptions |  |
| getRootDir |  | () => string \\| null |  |
| onSegment |  | (callback: SegmentCallback) => void | Register a callback that fires for each segment emitted during transform. |
| registerBundleGraphAdder |  | (adder: [BundleGraphAdder](#bundlegraphadder)) => void |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/vite.ts)

## QwikVitePluginOptions

```typescript
export type QwikVitePluginOptions =
  | QwikVitePluginCSROptions
  | QwikVitePluginSSROptions;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/plugins/vite.ts)

## ResolvedManifest

```typescript
export interface ResolvedManifest
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| bundleGraph? |  | [QwikBundleGraph](#qwikbundlegraph) | _(Optional)_ |
| injections? |  | [GlobalInjections](#globalinjections)[] | _(Optional)_ |
| manifest |  | [ServerQwikManifest](#serverqwikmanifest) |  |
| mapper |  | [SymbolMapper](#symbolmapper) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## ServerQwikManifest

The manifest values that are needed for SSR.

```typescript
export type ServerQwikManifest = Pick<
  QwikManifest,
  | "manifestHash"
  | "injections"
  | "bundleGraph"
  | "bundleGraphAsset"
  | "mapping"
  | "preloader"
  | "core"
  | "qwikLoader"
>;
```

**References:** [QwikManifest](#qwikmanifest)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## show

## suspense

## SymbolMapper

```typescript
export type SymbolMapper = Record<
  string,
  readonly [symbol: string, chunk: string]
>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## SymbolMapperFn

```typescript
export type SymbolMapperFn = (
  symbolName: string,
  mapper: SymbolMapper | undefined,
  parent?: string,
) => readonly [symbol: string, chunk: string] | undefined;
```

**References:** [SymbolMapper](#symbolmapper)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-vite/src/types.ts)

## valibot
