Skip to content

Don't cache-bust the pre-built Yardline RC bundle - #29

Merged
vetonshabani0 merged 1 commit into
mainfrom
fix/stamp-skip-prebuilt
Jul 23, 2026
Merged

Don't cache-bust the pre-built Yardline RC bundle#29
vetonshabani0 merged 1 commit into
mainfrom
fix/stamp-skip-prebuilt

Conversation

@vetonshabani0

Copy link
Copy Markdown
Collaborator

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.mjs appends ?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 from import.meta.url. So the ?v on the entry rides along to lazily-imported chunks, while their modulepreload copies have none → the browser loads a second copy of shared Babylon modules → duplicate class decorators throw:

Cannot redefine property: onBeforeViewRenderObservable

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=guid to a known-good build's entry reproduces the crash locally; removing it renders.

Fix: a NO_STAMP list — yardline-rc is copied but never stamped. Content hashes already cache-bust it.

Verified: ran the real npm run build, served the stamped _dist under a /yardline-rc/ subpath on a real GPU (headful Chrome) — car on the pedestal, no crash. Zero-build games (tetris etc.) still get ?v stamps.

Deploy: after merge, redeploy web-api on Render.

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.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview for fix/stamp-skip-prebuilt: https://space-console.github.io/games/preview/fix-stamp-skip-prebuilt-fd71/

@vetonshabani0
vetonshabani0 merged commit 4024594 into main Jul 23, 2026
4 checks passed
@vetonshabani0
vetonshabani0 deleted the fix/stamp-skip-prebuilt branch July 23, 2026 18:52
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