A page from before a deploy can still find its chunks, or reload once

Sentry WIZWAR-5: a table open through a deploy asked for the replay
module by its old hashed name, the deploy had deleted it, and the
server answered with the app shell as text/html — "not a valid
JavaScript MIME type". Three guards: deploys keep old chunks for a
week instead of deleting them; a missing asset is a plain 404, never
the shell; and the client reloads once when Vite reports a failed
import, so the live bundle takes over.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-04 20:30:39 -04:00
co-authored by Claude Fable 5.1
parent fa5a5a07a7
commit 0911312f98
3 changed files with 25 additions and 2 deletions
+4 -1
View File
@@ -4,11 +4,14 @@ set -euo pipefail
HOST="${1:?usage: deploy.sh <droplet-ip-or-host>}"
npm run build --workspace=@wizwar/web
rsync -az --delete \
# Old hashed chunks stay a week: a page loaded before this deploy can still
# fetch the module it was built against instead of failing mid-game.
rsync -az --delete --filter='P packages/web/dist/assets/*' \
--exclude node_modules --exclude data/ --exclude .git --exclude research \
./ "root@$HOST:/opt/wizwar/"
ssh "root@$HOST" '
cd /opt/wizwar && npm install --no-audit --no-fund
find /opt/wizwar/packages/web/dist/assets -type f -mtime +7 -delete
chown -R wizwar:wizwar /opt/wizwar
cp /opt/wizwar/deploy/wizwar.service /etc/systemd/system/wizwar.service
# Cron runs the backup and the rollup from /usr/local/bin: install