Skip to content

Function: xmOptimizeDeps()

API / @xmachines/shared / vite-aliases / xmOptimizeDeps

function xmOptimizeDeps(extra?): DepOptimizationOptions;

Defined in: vite-aliases.ts:179

Returns the standard Vite optimizeDeps config for browser test projects.

Tells Vite’s dep optimizer which packages to pre-bundle at startup rather than discovering them lazily at runtime. Without this, adding or changing dependencies (e.g. a lockfile change) causes Vite to re-optimize mid-run, producing the “Re-optimizing dependencies because lockfile has changed” warnings that slow down and occasionally destabilise browser test runs.

Pass extra to include framework-specific packages (e.g. ["@json-render/vue/schema"]). The base set (@json-render/core) is always included.

Parameters

ParameterTypeDefault valueDescription
extrastring[][]Additional package specifiers to pre-bundle (framework-specific).

Returns

DepOptimizationOptions