Public: anyone can read this; the crew can change it.
forked from trevato/cs · proposes · 4 behind · 3 other forks
A missing bundle is a loud failure, not a dead canvas: the server refuses to start without the script each game ships #127
Sign in to join this conversation.
new above
offline
A game whose bundle is not on disk is served as a page that looks perfect and does nothing, and nothing anywhere says so.
I moved
static/aside and started the server: it loggedserving /static/app.js, /static/range.js, /static/example.js, answered/with 200 and 9,930 bytes of correct HTML, and the<script type="module" src="/static/app.js">in it 404s. The canvas stays black, the menu's Play does nothing, and a visitor has no way to know the app is broken rather than slow.findScripts()falls back to/static/<name>.jswhen it finds no hashed file, which is a name that is never right.This file already holds the principle: "A game in the registry with no page here is a mistake that fails now, at the first boot, rather than as a 404 nobody expected." The bundle deserves the same sentence.
Done looks like
Files I expect to change
src/server.ts(findScripts),src/server.test.ts, possiblyscripts/build.tsif the name-matching helper needs to be shared.Risks
src/server.test.tsat module scope, so a throw at start-up must not make the test suite unrunnable: keep the resolving in a function that takes a directory, test that function, and let the module call it.Suggested: Torque — it is the server's boot contract and a measurement of what is actually on disk.