Files
token-circles/frontend/tsconfig.json
T
KomediruzeckiandGitHub 41fbe3a519 fix: recover from stale-cache white screens after a deploy (#339)
Returning users hit a white screen after a deploy: the service worker served a
stale index.html referencing hashed chunks that were gone, and the assets host
returned index.html (200, text/html) for those missing chunks — so the module
loader failed with a MIME error, unrecoverable by a normal reload (only a desktop
hard-reload, which bypasses the SW, fixed it). This adds a layered strategy.

Good path (prevent the break):
- Front Worker (frontend/server/assets-worker.ts) + assets binding: a missing
  /assets/* now returns a real 404, never index.html; navigations still get the
  SPA shell. Confirmed via wrangler dev.
- _headers cache tiers: /assets/* immutable; index.html, sw.js, version.json
  no-cache (previously everything was max-age=0, must-revalidate).
- Service worker hardening: cleanupOutdatedCaches, skipWaiting + clientsClaim,
  navigateFallback denylist for /assets, /api, version.json; cache only 200s;
  fresh v4 cache names so a pre-fix poisoned entry can't be replayed.
- version.json + poller (core/appVersion.ts): on a new deploy, reload at a safe
  moment (next navigation) with a toast fallback — kills the mid-session
  dead-chunk navigation crash.

Bad path (recover gracefully):
- Pre-JS boot watchdog in index.html: if an app asset errors or the app never
  boots, clear the SW + caches and reload once, then show a manual recovery
  panel — works even when the bundle itself never loads.
- Runtime vite:preloadError / chunk-error handler (core/bootRecovery.ts): one
  guarded auto-reload, else escalate to the crash screen.
- CrashModal: add "Clear cache & reload" (SW + Cache Storage, keeps user data)
  and tailored "Update available" messaging for chunk/MIME errors.

Hygiene:
- Self-host fonts (@fontsource Inter/Fraunces/JetBrains Mono, latin + latin-ext):
  removes the cross-origin Google Fonts dependency and its CSP violations; drops
  the Google origins from the report-only policy.

Verified: front-worker 404 vs SPA fallback via wrangler dev; typecheck/lint/build
clean; 550 tests pass; app boots with self-hosted fonts and no CSP violations.
2026-07-15 15:41:59 +02:00

47 lines
1.1 KiB
JSON

{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"skipLibCheck": true,
"types": ["vite/client"],
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
/* Linting */
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@/core/*": ["src/core/*"],
"@/features/*": ["src/features/*"],
"@/components/*": ["src/components/*"],
"@/stores/*": ["src/stores/*"],
"@/types/*": ["src/types/*"],
"@/lib/*": ["src/lib/*"],
"@/css/*": ["src/css/*"]
},
"plugins": [
{
"name": "typescript-plugin-css-modules",
"options": {
"classnameTransform": "camelCaseOnly",
"goToDefinition": true
}
}
]
},
"include": ["src/**/*", "tests/**/*", "server/**/*", "css-modules.d.ts"]
}