new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vite · Config reference · all subjects

optimizedeps

12 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

optimizeDeps.entries type and purpose

optimizeDeps.entries is of type string | string[]. By default, Vite crawls all .html files to detect dependencies that need to be pre-bundled (ignoring node_modules, build.outDir, __tests__ and coverage). If the top-level input or build.rolldownOptions.input is specified, Vite crawls those entry points instead. This option allows specifying custom entries using tinyglobby pattern(s) relative from Vite project root to overwrite default entries inference. Only node_modules and build.outDir folders are ignored by default when optimizeDeps.entries is explicitly defined. Other folders can be ignored using ignore patterns marked with an initial !. node_modules will not be ignored for patterns that explicitly include the string node_modules.

optimizeDeps.exclude type and purpose

optimizeDeps.exclude is of type string[]. It specifies dependencies to exclude from pre-bundling. CommonJS dependencies should not be excluded from optimization. If an ESM dependency is excluded from optimization but has a nested CommonJS dependency, the CommonJS dependency should be added to optimizeDeps.include.

optimizeDeps.include type and purpose

optimizeDeps.include is of type string[]. By default, linked packages not inside node_modules are not pre-bundled. This option forces a linked package to be pre-bundled. Experimentally, you can specify a trailing glob pattern to pre-bundle all deep imports at once, avoiding constantly re-bundling whenever a new deep import is used.

optimizeDeps.include example with glob pattern

export default defineConfig({ optimizeDeps: { include: ['my-lib/components/**/*.vue'], }, }) This example shows using a glob pattern to pre-bundle all deep imports from my-lib/components.

optimizeDeps.include example with nested CommonJS

export default defineConfig({ optimizeDeps: { include: ['esm-dep > cjs-dep'], }, }) This example shows how to include a nested CommonJS dependency when the ESM parent is excluded from optimization.

optimizeDeps.rolldownOptions type and purpose

optimizeDeps.rolldownOptions is of type Omit<RolldownOptions, 'input' | 'logLevel' | 'output'> & { output?: Omit<RolldownOutputOptions, 'format' | 'sourcemap' | 'dir' | 'banner'> }. It specifies options to pass to Rolldown during dep scanning and optimization. Certain options are omitted since changing them would not be compatible with Vite's dep optimization. The plugins option is merged with Vite's dep plugin.

optimizeDeps.esbuildOptions deprecated

optimizeDeps.esbuildOptions is deprecated. This option is of type Omit<EsbuildBuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>. It is converted to optimizeDeps.rolldownOptions internally, so use optimizeDeps.rolldownOptions instead.

optimizeDeps.force type and purpose

optimizeDeps.force is of type boolean. Set to true to force dependency pre-bundling, ignoring previously cached optimized dependencies.

optimizeDeps.noDiscovery type and default

optimizeDeps.noDiscovery is of type boolean with a default value of false. When set to true, automatic dependency discovery is disabled and only dependencies listed in optimizeDeps.include are optimized. CJS-only dependencies must be present in optimizeDeps.include during dev.

optimizeDeps.holdUntilCrawlEnd type and default

optimizeDeps.holdUntilCrawlEnd is of type boolean with a default value of true. This is an experimental option. When enabled, it holds the first optimized deps results until all static imports are crawled on cold start, avoiding the need for full-page reloads when new dependencies are discovered and trigger the generation of new common chunks. If all dependencies are found by the scanner plus those explicitly defined in include, it is better to disable this option to let the browser process more requests in parallel.

optimizeDeps.disabled type and default

optimizeDeps.disabled is of type boolean | 'build' | 'dev' with a default value of 'build'. This option is deprecated and experimental. As of Vite 5.1, pre-bundling of dependencies during build has been removed. Setting optimizeDeps.disabled to true or 'dev' disables the optimizer, and configuring it to false or 'build' leaves the optimizer enabled during dev. To disable the optimizer completely, use optimizeDeps.noDiscovery: true to disallow automatic discovery of dependencies and leave optimizeDeps.include undefined or empty. Optimizing dependencies during build time was an experimental feature.

optimizeDeps.needsInterop type and purpose

optimizeDeps.needsInterop is of type string[]. This is an experimental option. It forces ESM interop when importing these dependencies. Vite can properly detect when a dependency needs interop, so this option is not generally needed. However, different combinations of dependencies could cause some of them to be pre-bundled differently. Adding these packages to needsInterop can speed up cold start by avoiding full-page reloads. A warning is provided if this is the case for one of your dependencies, suggesting to add the package name to this array in the config.

Give your agent this brain