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
optionplugins
are merged with Vite's dep pluginDo not optimize these dependencies (must be resolvable import paths, cannot be globs).
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.
Force optimize listed dependencies (must be resolvable import paths, cannot be globs).
Forces ESM interop when importing these dependencies. Some legacy
packages advertise themselves as ESM but use require
internally
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.
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.
'build'