PWA configuration
vite-plugin-pwa in vite.config.ts. Workbox generates dist/sw.js. There is no public/sw.js.
Related: Build & Deployment, Development Workflow.
Overview#
Offline shell, install prompts, large cache for Pyodide and wheels.
VitePWA plugin integration#
flowchart TD Plugin["VitePWA"] --> Manifest["manifest.webmanifest"] Plugin --> SW["sw.js Workbox"] Plugin --> Inject["injectRegister auto"]
| Property | Value |
|---|---|
registerType |
autoUpdate |
injectRegister |
auto |
devOptions.enabled |
true |
Workbox caching configuration#
flowchart TD Glob["globPatterns js css html ico png svg whl"] --> Precache Runtime["CacheFirst pyodide.js"] --> Named["pyodide-cache 1000 days"] Extra["additionalManifestEntries"] --> Wheels["jiit_marks PyMuPDF"]
maximumFileSizeToCacheInBytes is 30MB.
Wheel URLs use ${artifactBase} so GitHub Pages (/jportal/artifact/...) and Cloudflare (/artifact/...) both work.
fakedata.json is bundled from src/assets, not public/. JSON is not in globPatterns. Demo still works online because the JSON is in the JS bundle.
Web app manifest#
flowchart TD M["manifest"] --> Name["JPortal"] M --> Start["start_url = base"] M --> Display["standalone portrait"] M --> Color["#35;191c20"] M --> Icons["circle.ico j-yuvraj.svg"]
| Field | Value |
|---|---|
| name / short_name | JPortal |
| description | A web portal for students to view attendance and grades. |
| start_url | base from Vite |
| display | standalone |
| background_color / theme_color | #191c20 |
| orientation | portrait |
Icons: 48 ico, maskable svg 72/96, svg 128/256, svg 512.
Offline capabilities#
flowchart TD First["first visit"] --> Cache["Workbox precache"] Cache --> Shell["HTML JS CSS icons"] Cache --> Py["pyodide.js + wheels"] API["JIIT API"] --> NoCache["not cached"]
Portal responses are not stored in the SW. Offline is the app shell plus demo bundle, not live attendance.
Installation flow#
flowchart TD Visit["open live URL"] --> Prompt["browser install UI"] Prompt --> Android["Add to Home screen"] Prompt --> iOS["Share Add to Home Screen"] Prompt --> Win["URL bar install"]
Dev mode: npm run dev still registers a worker because devOptions.enabled is true.