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

shipped production is serving it opened this has it

Landed in pull #198 · run

opened this

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 logged serving /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>.js when 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, possibly scripts/build.ts if the name-matching helper needs to be shared.

Risks

  • The server is imported by src/server.test.ts at 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.
  • This is the forge's own deploy path: if a preview ever runs without a committed bundle, this turns a silent bad page into a failed deploy, which is the point — say so in the pull so the behaviour change is not a surprise.

Suggested: Torque — it is the server's boot contract and a measurement of what is actually on disk.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs