Repository navigation
fix: serve the frontend at the domain root - #57
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The production build used Vite
base: '/frontend/', a sub-path that nothing serves. The container runsserve -s distat the root, andoswatcher-deploy's Traefik routesHost()to it with no path prefix. Every hashed asset reference (/frontend/assets/*.js) fell through the SPA fallback and returnedindex.htmlwith a 200, so the page loaded as a blank shell.This blocks
oswatcher-deploy#10, which pullsghcr.io/oswatcher/frontend:latestfor the local-eval and server stacks.Change
vite.config.ts:base: '/'in all modes. Development already used/, so only the published image changes.scripts/smoke-test.mjs, wired intobuild.yml) that runs the image and asserts whatnpm run build-onlycannot 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
docker build --build-arg NODE_ENV=production)🤖 Generated with Claude Code