// Base-path helpers for the single-origin deployment. The game UI is // served under `kit.paths.base` — empty at the root for local dev, // vitest, and Playwright, and `/game` in the deployed single-origin // build. SvelteKit does not auto-prefix `goto`, ``, raw asset // fetches, or the service-worker scope, so every app-internal absolute // path is routed through `withBase`. // // `base` from `$app/paths` is the low-level primitive that `resolve()` // builds on. We use it directly here (rather than `resolve()`) because // the client navigates to and fetches dynamic, runtime-built paths // (command routes, `core.wasm`, the service worker) that `resolve()`'s // statically-typed route-id surface cannot express. import { base } from "$app/paths"; /** appBase is the configured base path (empty string at the root). */ export const appBase = base; /** * withBase prefixes an app-internal absolute path (leading slash) with * the configured base path. At the root it returns the path unchanged; * under the single-origin deployment it yields e.g. `/game/lobby`. */ export function withBase(path: string): string { return `${base}${path}`; }