Don't cache-bust the pre-built Yardline RC bundle - #29
Merged
Conversation
The deploy stamp appends ?v=<guid> to every game's entry <script src>. That's correct for the hand-written zero-build games, but it was breaking Yardline RC, a pre-built Vite app. Its assets are already content-hashed (cache-busted), and the app derives dynamic-import URLs from import.meta.url — so the ?v on the entry rides along to lazily-loaded chunks while their preloaded copies have none. The browser then loads a SECOND copy of shared Babylon modules, whose duplicate class decorators throw `Cannot redefine property: onBeforeViewRenderObservable` at scene init, aborting model loading — the garage rendered but no cars. This is why the game worked when served straight from the vite build but broke once it went through the deploy stamp (both on GitHub Pages and on Render). Fix: a NO_STAMP list; yardline-rc is copied but never stamped. Verified by running the real build and rendering the stamped _dist under a subpath on a real GPU — the car is on the pedestal, no crash. Zero-build games still get stamped.
Contributor
|
🚀 Preview for |
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.
This is the fix that makes the deployed Yardline RC actually render. The earlier dedupe (#27) and
useDefineForClassFields(#28) fixes were correct and necessary, but the deployed copy still crashed — because the deploy stamp was mangling it.Root cause:
scripts/stamp.mjsappends?v=<guid>to every game's entry<script src>for cache-busting. Correct for the hand-written zero-build games. But Yardline RC is a pre-built Vite app: its chunks are already content-hashed, and it derives dynamic-import URLs fromimport.meta.url. So the?von the entry rides along to lazily-imported chunks, while theirmodulepreloadcopies have none → the browser loads a second copy of shared Babylon modules → duplicate class decorators throw:The scene's first meshes render (garage), then it dies before the cars — the exact symptom. This is why it worked served straight from the Vite build but broke through the deploy stamp (on both GitHub Pages and Render).
Proof: adding
?v=guidto a known-good build's entry reproduces the crash locally; removing it renders.Fix: a
NO_STAMPlist —yardline-rcis copied but never stamped. Content hashes already cache-bust it.Verified: ran the real
npm run build, served the stamped_distunder a/yardline-rc/subpath on a real GPU (headful Chrome) — car on the pedestal, no crash. Zero-build games (tetris etc.) still get?vstamps.Deploy: after merge, redeploy web-api on Render.