Skip to content

@modoki/engine / index / assetUrl

Function: assetUrl()

assetUrl(path): string

Prefix a root-absolute asset path with Vite's BASE_URL so runtime fetches resolve when the app is hosted under a sub-path (e.g. "/demo/"). No-op when BASE_URL is "/" (dev + native Capacitor builds). Pass-through for relative, http, data, and blob URLs; idempotent for already-prefixed paths.

Parameters

path

string

Returns

string

Built with Modoki.