Repository navigation
feat(pwa): play offline, with updates offered on the map - #55
Merged
Merged
Conversation
vite-plugin-pwa (dev) generates a Workbox service worker that precaches the whole app on the first visit (page, JS, CSS, Latin fonts, manifest), with clientsClaim so a level opened before any reload works offline too. Updates never auto-reload: platform/AppUpdate records a waiting version and the map shows 'A new version of ML Quest is ready. Update now'. Registration via workbox-window (runtime dep, 2.2 kB gzip, lazy) in production builds only. Adds a web app manifest and theme colour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
The README and AGENTS say the game "works offline"; now it does, following ARCHITECTURE §11 (updated to match what's built).
vite-plugin-pwagenerates a Workbox service worker that precaches the whole app on the first visit: page, both JS chunks, CSS, the Latin font subsets, manifest (14 entries, ~860 KB before compression; all v1 level data is bundled, so everything is playable offline). Non-Latin font subsets load on demand instead.clientsClaimmakes the first worker control the page immediately; without it, a level opened before any reload failed offline (found in the browser check below).registerType: 'prompt', noskipWaiting.platform/AppUpdaterecords a waiting version; the map (and only the map) shows "A new version of ML Quest is ready." [Update now], which hands over to the new worker and reloads.platform/ServiceWorkerusesworkbox-windowdirectly (not the plugin'svirtual:module, which dependency-cruiser can't resolve, so no rule had to be loosened), only in production builds, and loaded lazily.<meta name="theme-color">; the manifest resolves under/ml-quest/on Pages.Dependencies (RULES §10)
workbox-window7.4.1 (runtime): registers the worker and handles the update hand-off. 2.2 kB gzip, in a lazy chunk: first load stays 163.8 / 170 kB.vite-plugin-pwa1.3.0 (dev only): generatessw.jsand the manifest at build time; supports Vite 8.Verification
AppUpdate: an update waits until asked, then applies with reload; app test: the banner appears on the map but not on a level, and "Update now" applies it), 118 pass-bot runs, levels:validate, build, size: all green.#/w/2/l/5renders Tame It completely.🤖 Generated with Claude Code