23 lines · 928 B · TypeScript
RawDownload
// Thin wrapper around the auto-generated asset manifest.//// `assets.generated.ts` is regenerated by `script/generate-web-assets.ts`// after each `vite build` of frontend/workspace, and is gitignored — so on a fresh// clone (or in dev mode where the SPA hasn't been built) it won't exist yet.// The dynamic import keeps the wrapper resolvable in that case; `openscience web`// will then 404 every UI request until the next `vite build` populates it. let _assets: Record<string, string> = {}let _index: string | undefined try {  const gen = await import("./assets.generated")  _assets = gen.WEB_ASSETS ?? {}  _index = gen.WEB_INDEX} catch {  // assets.generated.ts not present — `openscience web` will 404 SPA routes.  // Run `bun run script/generate-web-assets.ts` (after `vite build` in  // frontend/workspace) to populate the manifest.} export const WEB_ASSETS = _assetsexport const WEB_INDEX = _index