Skip to content

fix: serve the frontend at the domain root - #57

Merged
Wenzel merged 1 commit into
masterfrom
fix/container-asset-path
Sep 7, 2026
Merged

Wenzel merged 1 commit into
masterfrom
fix/container-asset-path

Conversation

@Wenzel

@Wenzel Wenzel commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

The production build used Vite base: '/frontend/', a sub-path that nothing serves. The container runs serve -s dist at the root, and oswatcher-deploy's Traefik routes Host() to it with no path prefix. Every hashed asset reference (/frontend/assets/*.js) fell through the SPA fallback and returned index.html with a 200, so the page loaded as a blank shell.

This blocks oswatcher-deploy#10, which pulls ghcr.io/oswatcher/frontend:latest for the local-eval and server stacks.

Change

  • vite.config.ts: base: '/' in all modes. Development already used /, so only the published image changes.
  • New post-build smoke test (scripts/smoke-test.mjs, wired into build.yml) that runs the image and asserts what npm run build-only cannot see: assets load from /assets/ with the right content type rather than the HTML fallback, the runtime __OSW_API_URI__ placeholder is substituted, and history-mode deep links serve the app shell.

Validation

  • Image built with production args (docker build --build-arg NODE_ENV=production)
  • Smoke test passes against the running container

🤖 Generated with Claude Code

The production build used base '/frontend/', a sub-path that nothing serves.
The container runs `serve -s dist` at the root and oswatcher-deploy's Traefik
routes Host(`<DOMAIN>`) to it with no path prefix, so every hashed asset
reference (`/frontend/assets/*.js`) fell through to the SPA fallback and the
page loaded as a blank shell.

Set base '/' in all modes. Development already used it, so only the published
image changes.

Add a post-build smoke test (scripts/smoke-test.mjs, wired into build.yml)
that runs the image and asserts what `npm run build-only` cannot see: assets
load from `/assets/` with the right content type rather than the HTML
fallback, the runtime API placeholder is substituted, and history-mode deep
links serve the app shell.

Verified: image built with production args, smoke test passes against the
running container.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WnrRvhmHcMPj6iwJ2NnzK
@Wenzel
Wenzel merged commit ad531f1 into master Sep 7, 2026
4 checks passed
@Wenzel
Wenzel deleted the fix/container-asset-path branch September 7, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant