Overview
loader-website is a browser application (HTML + TypeScript) bundled as static assets and served by loader-client. It is the loading screen the player sees before the game starts. It fetches the game’s file list from the server, downloads and caches each file locally in the browser, then dynamically imports the game entry point and starts it.
This package is a dependency of loader-client and is not consumed directly.
Loading sequence
When the browser opens the loader URL, the following steps happen in order:- Fetch manifest — requests
/manifestto get the game version and the list of files to download. - Verify cache — checks whether the game files from the previous session are still present in the browser’s Origin Private File System (OPFS). The loading screen shows “Verifying application integrity”.
- Download files — if the cache is stale or missing, downloads each game file from
/game/*and writes it into OPFS. The loading screen shows a progress bar and the name of the current file. - Fetch environment — requests
/envto get theNANOFORGE_*variables forwarded byloader-client. - Bootstrap game — dynamically imports
/main.jsfrom the local OPFS cache, calls its exportedmain({ files, env, container }), and fades out the loading screen.
Game interface
loader-website calls the game’s main export with the following shape:
Watch mode
Whenloader-client starts with --watch, the manifest response includes a watch.url WebSocket URL. loader-website connects to that URL and listens for messages. When it receives an update message it reloads the page, giving the developer an automatic live-reload experience.
Error display
loader-website installs global handlers for error and unhandledrejection window events. If the game throws or rejects after starting, the error message is surfaced on the loading screen instead of failing silently.
Requirements
loader-website uses the browser’s Origin Private File System (OPFS) API to cache game files locally. This API is only available in a secure context — either localhost or a page served over HTTPS.
Start loader-client with --cert and --key to enable HTTPS when running on a non-localhost address.
Examples
The website loader is not invoked directly. Start it via the CLI orloader-client: