Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vitejs/vite/llms.txt
Use this file to discover all available pages before exploring further.
- Related: Dependency Pre-Bundling
optimizeDeps.entries
- Type:
string | string[]
.html files to detect dependencies that need to be pre-bundled (ignoring node_modules, build.outDir, __tests__ and coverage). If build.rollupOptions.input is specified, Vite will crawl those entry points instead.
If neither of these fit your needs, you can specify custom entries using this option - the value should be a tinyglobby pattern or array of patterns that are relative from Vite project root. This will overwrite default entries inference. Only node_modules and build.outDir folders will be ignored by default when optimizeDeps.entries is explicitly defined. If other folders need to be ignored, you can use an ignore pattern as part of the entries list, marked with an initial !. node_modules will not be ignored for patterns that explicitly include the string node_modules.
optimizeDeps.exclude
- Type:
string[]
optimizeDeps.include
- Type:
string[]
node_modules are not pre-bundled. Use this option to force a linked package to be pre-bundled.
Experimental: If you’re using a library with many deep imports, you can also specify a trailing glob pattern to pre-bundle all deep imports at once. This will avoid constantly pre-bundling whenever a new deep import is used. Give Feedback. For example:
optimizeDeps.rolldownOptions
- Type:
Omit<RolldownOptions, 'input' | 'logLevel' | 'output'> & { output?: Omit<RolldownOutputOptions, 'format' | 'sourcemap' | 'dir' | 'banner'> }
pluginsare merged with Vite’s dep plugin
optimizeDeps.esbuildOptions
- Type:
Omit<EsbuildBuildOptions, | 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'> - Deprecated
optimizeDeps.rolldownOptions internally. Use optimizeDeps.rolldownOptions instead.
optimizeDeps.force
- Type:
boolean
true to force dependency pre-bundling, ignoring previously cached optimized dependencies.
optimizeDeps.noDiscovery
- Type:
boolean - Default:
false
true, automatic dependency discovery will be disabled and only dependencies listed in optimizeDeps.include will be optimized. CJS-only dependencies must be present in optimizeDeps.include during dev.
optimizeDeps.holdUntilCrawlEnd
- Experimental: Give Feedback
- Type:
boolean - Default:
true
include, it is better to disable this option to let the browser process more requests in parallel.
optimizeDeps.disabled
- Deprecated
- Experimental: Give Feedback
- Type:
boolean | 'build' | 'dev' - Default:
'build'
optimizeDeps.disabled to true or 'dev' disables the optimizer, and configured to false or 'build' leaves the optimizer during dev enabled.
To disable the optimizer completely, use optimizeDeps.noDiscovery: true to disallow automatic discovery of dependencies and leave optimizeDeps.include undefined or empty.
optimizeDeps.needsInterop
- Experimental
- Type:
string[]
needsInterop can speed up cold start by avoiding full-page reloads. You’ll receive a warning if this is the case for one of your dependencies, suggesting to add the package name to this array in your config.