Pin Vite entry filename to assets/app.js so the deploy wrapper template can hardcode a stable URL#75
Open
nx-thaddeusaid wants to merge 1 commit into
Conversation
…plate reference The roguewar.org server template that produces /warmap currently hardcodes or auto-extracts one script tag from dist/index.html and gets the wrong file: it loads /warmap/assets/vendor-ui-<hash>.js (the react-select + lucide-react chunk) instead of the actual entry. Without the entry, React never mounts and the page renders only the dark body background. Pinning the entry to assets/app.js gives the wrapper template a single stable URL that does not change across builds. Vendor chunks and CSS keep their content-hashed names — they are loaded by the entry via dynamic imports and the modulepreload links Vite emits, not by the wrapper. The deploy server should cache app.js with a short max-age (or no-cache) since its URL no longer cache-busts; everything it imports is still content-hashed and can be cached aggressively. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Pins the Vite entry script to
dist/assets/app.js(no content hash) so the roguewar.org server template that produces the/warmappage can hardcode a single stable URL.This is the WarMap-side change needed to unblock the wrapper template; see the companion writeup that Thaddeus is forwarding to the deploy owner (Nyx) for the full diagnosis and the matching one-line template edit.
Why
https://www.roguewar.org/warmapcurrently renders as a black page. The build is correct — every asset is on the server and returns 200 — but the wrapper template only loads/warmap/assets/vendor-ui-<hash>.js(thereact-select+lucide-reactchunk pervite.config.tsmanualChunks) instead of the actual entry. Without the entry, React never mounts into#react-root.A local docker reproduction using the deploy
Dockerfile(node:22-alpine +yarn run build --base=/warmap) confirmed the build artifacts work when served directly via nginx. The bug is purely in the wrapper template's asset-picking logic.The cleanest WarMap-side mitigation is to give the wrapper template a single stable URL it can hardcode and never need to extract again.
What changes
After this lands, the build emits:
assets/index-<hash>.jsassets/app.js(stable)assets/index-<hash>.cssassets/index-<hash>.css(unchanged)rolldown-runtime,vendor-{core,ui,konva}Vendor chunks and CSS keep their content-hash for cache-busting. They are loaded by the entry via dynamic imports / Vite's modulepreload links, not by the wrapper template, so their hashed names are not a problem.
Caching note for the deploy server
app.jsno longer cache-busts via filename. The deploy should send a short or no-cache header on that one URL so changes take effect immediately, while keeping aggressive caching on the hashed assets:This is a server-side config tweak, separate from this PR.
Test plan
yarn install,yarn lint,npx tsc -p tsconfig.app.json --noEmit,npx tsc -p tsconfig.vitest.json --noEmit,yarn test(155 tests),yarn test:coverage— all greenVITE_BASE_URL=/warmap yarn buildproducesdist/assets/app.jsanddist/index.htmlreferences/warmap/assets/app.jsas the entryyarn run build --base=/warmap) confirms the same —dist/assets/app.jsis in the output,dist/index.htmlreferences it/warmap/assets/app.js→https://www.roguewar.org/warmaprenders the galaxy map