Skip to content

resolveUiDir

function resolveUiDir(moduleUrl, candidates?): string | undefined;

Defined in: src/server/static-assets.ts:94

Locate a product’s built SPA. Pass the product module’s import.meta.url: compiled (the npm-consumer case) the bundle is the sibling ./ui of the module’s dist/ chunk; run from TypeScript source (examples, file: links) it is <repo>/dist/ui. Falls back to the compiled-layout path so the “build the UI” hint still fires when nothing is built yet.

Extra candidates (relative to moduleUrl) are tried first. Returns undefined when the module URL is not a file: URL or the runtime has no node:fs (Workers): the panel then serves the API and a fallback page.

Parameter Type Default value
moduleUrl string | URL undefined
candidates? readonly string[] []

string | undefined

const uiDir = options.uiDir ?? resolveUiDir(import.meta.url);