optimizeDeps Options
The optimizeDeps block tunes how the dev server handles your bare (node_modules) dependencies. Vantris bundles them on demand by default — these options let you pre-bundle at startup or opt out of bundling. For the full model, see Dependency Pre-Bundling.
import { defineConfig } from "vantris";
export default defineConfig({
optimizeDeps: {
include: ["react", "react-dom/client"],
exclude: ["some-esm-only-lib"],
},
});optimizeDeps.include
- Type:
string[] - Default:
[]
Packages to pre-bundle at dev-server startup instead of on first import. Everything else is still bundled on demand, so this list is a warm-up hint — you only name the deps you want ready ahead of time. Subpaths are allowed.
optimizeDeps: { include: ["react", "react-dom/client", "lodash-es"] }The @vantris/react plugin seeds this list with the React packages automatically, so you don't have to list them yourself when using it.
optimizeDeps.exclude
- Type:
string[] - Default:
[]
Packages to exclude from bundling — served as native ESM straight from node_modules. Matched by package name; every subpath of a listed package is excluded too.
optimizeDeps: { exclude: ["some-esm-only-lib"] }Pure-ESM only
Only pure-ESM packages qualify. A listed package that turns out to be CommonJS can't run natively in the browser, so Vantris bundles it anyway and logs a warning.
Notes
- These options affect the dev server only. The production build handles dependencies through Rolldown.
- Pre-bundled deps are cached in
node_modules/.vantris/deps/and served from/@vantris/deps/, marked third-party so DevTools greys them out. See Internal Cache.
OptimizeDepsConfig at a glance
interface OptimizeDepsConfig {
include?: string[];
exclude?: string[];
}