Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DepOptimizationConfig

Index

Properties

disabled?: boolean | "build" | "dev"

Disables dependencies optimizations, true disables the optimizer during build and dev. Pass 'build' or 'dev' to only disable the optimizer in one of the modes. Deps optimization is enabled by default in dev only.

default

'build'

experimental
esbuildOptions?: Omit<BuildOptions, "external" | "watch" | "write" | "bundle" | "entryPoints" | "outdir" | "outfile" | "outbase" | "outExtension" | "metafile">

Options to pass to esbuild during the dep scanning and optimization

Certain options are omitted since changing them would not be compatible with Vite's dep optimization.

  • external is also omitted, use Vite's optimizeDeps.exclude option
  • plugins are merged with Vite's dep plugin

https://esbuild.github.io/api

exclude?: string[]

Do not optimize these dependencies (must be resolvable import paths, cannot be globs).

extensions?: string[]

List of file extensions that can be optimized. A corresponding esbuild plugin must exist to handle the specific extension.

By default, Vite can optimize .mjs, .js, .ts, and .mts files. This option allows specifying additional extensions.

experimental
include?: string[]

Force optimize listed dependencies (must be resolvable import paths, cannot be globs).

needsInterop?: string[]

Forces ESM interop when importing these dependencies. Some legacy packages advertise themselves as ESM but use require internally

experimental
noDiscovery?: boolean

Automatic dependency discovery. When noDiscovery is true, only dependencies listed in include will be optimized. The scanner isn't run for cold start in this case. CJS-only dependencies must be present in include during dev.

default

false

experimental