Skip to content

Function: xmCacheDir()

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

function xmCacheDir(importMetaUrl, name): string;

Defined in: vite-aliases.ts:196

Returns the shared Vite cacheDir for this workspace package.

All browser test projects use a single cache under <workspace-root>/node_modules/.vite/ keyed by the project name. This means the dep optimizer runs once per project across the whole workspace rather than once per local node_modules/.vite/ directory, and a lockfile change only triggers one rebuild per project — not one per local cache.

Parameters

ParameterTypeDescription
importMetaUrlstringPass import.meta.url from the calling config file.
namestringUnique project name (matches test.name).

Returns

string