Skip to content

Function: xmAliases()

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

function xmAliases(importMetaUrl): Record<string, string>;

Defined in: vite-aliases.ts:24

Vite resolve.alias entries for all @xmachines/* workspace packages.

Maps every package to its TypeScript source entry so that npm run dev works without a prior npm run build. Required because npm run clean removes all dist/ directories — including transitive dependencies — leaving Vite unable to resolve package.json exports that point to dist/.

Usage in a demo vite.config.ts:

import { xmAliases } from “@xmachines/shared/vite-aliases”;

export default defineConfig({ resolve: { alias: xmAliases(import.meta.url) }, });

Parameters

ParameterTypeDescription
importMetaUrlstringPass import.meta.url from the calling config file. Used to locate the workspace root (the directory containing packages/).

Returns

Record<string, string>