Function: xmAliases()
API / @xmachines/shared / vite-aliases / xmAliases
function xmAliases(importMetaUrl): Record<string, string>;Defined in: vite-aliases.ts:221
Vite resolve.alias entries for all @xmachines/* workspace packages.
Maps every package to its TypeScript source entry so that pnpm run dev
works without a prior pnpm run build. Required because pnpm run clean
removes all dist/ directories — including transitive dependencies —
leaving Vite unable to resolve package.json exports that point to dist/.
The map is derived from the workspace layout at config-load time (see
buildAliases), so adding a new package needs no edit here. A few
special-case subpath aliases are maintained explicitly on top.
Usage in a demo vite.config.ts:
import { xmAliases } from “@xmachines/shared/vite-aliases”;
export default defineConfig({ resolve: { alias: xmAliases(import.meta.url) }, });
Parameters
| Parameter | Type | Description |
|---|---|---|
importMetaUrl | string | Pass import.meta.url from the calling config file. Used to locate the workspace root (the directory containing packages/). |
Returns
Record<string, string>