📋 Context & Problem Description
A primary drawback of Go-WASM applications is the size of the initial file download (app.wasm is 1.7 MB - 4.1 MB raw). Even though it compresses well with gzip/Brotli, a first-time loading latency exists over mobile networks. Furthermore, reload operations on unstable networks may reload files unnecessarily if standard browser caching policies expire or are ignored.
💡 Proposed Solution & Implementation Plan
Provide native Progressive Web App (PWA) and Service Worker support:
- Automatic Service Worker Generation:
Extend the Gutter build tool (gutter build) to automatically generate a service-worker.js file in the output directory.
- Offline Caching Strategy:
- Configure the Service Worker with a Cache-First strategy targeting static assets (
app.wasm, wasm_exec.js, styling sheets, static images).
- After the very first load,
app.wasm is served directly from the local browser Cache storage, reducing reload times to 0ms network cost.
- Background Updates:
- When a new version of the app is built and deployed, the Service Worker detects the hash change in
manifest.json.
- It fetches the updated
.wasm file in the background, prompting the user with an "update available" toast to refresh and apply the update.
🎯 Impact & Benefits
- Instant Load Times: Sub-10ms subsequent load times, bypassing network latency completely.
- Offline Capability: Enables full offline execution of Gutter apps, matching native application characteristics.
🏷️ Suggested Labels
feature, performance, cli
📋 Context & Problem Description
A primary drawback of Go-WASM applications is the size of the initial file download (
app.wasmis 1.7 MB - 4.1 MB raw). Even though it compresses well with gzip/Brotli, a first-time loading latency exists over mobile networks. Furthermore, reload operations on unstable networks may reload files unnecessarily if standard browser caching policies expire or are ignored.💡 Proposed Solution & Implementation Plan
Provide native Progressive Web App (PWA) and Service Worker support:
Extend the Gutter build tool (
gutter build) to automatically generate aservice-worker.jsfile in the output directory.app.wasm,wasm_exec.js, styling sheets, static images).app.wasmis served directly from the local browser Cache storage, reducing reload times to 0ms network cost.manifest.json..wasmfile in the background, prompting the user with an "update available" toast to refresh and apply the update.🎯 Impact & Benefits
🏷️ Suggested Labels
feature,performance,cli