fix(pwa): disable service worker in dev across all 8 vite configs
Was: every standalone (and the hub) registered a service worker during \`npm run dev\` via VitePWA's devOptions.enabled = true. Problem: the dev SW caches index.html and the JS bundle on first load and survives across vite restarts. Any code change that required a server restart (e.g. fixing a vite.config.ts merge conflict) resulted in browsers continuing to serve the cached pre-restart bundle until the user manually unregistered the SW. This caused the hub at localhost:5173 to redirect to /market on refresh — the cached bundle was from the broken-config period which still had the old monolithic main app's market route. PWA features (offline, install prompts, manifest) are still tested by running: npm run preview # for the hub npm run preview:<name> # for any standalone against a real production build, which is the more accurate environment for PWA verification anyway. Recovery for anyone with a stale SW lingering in their browser (needed once after pulling, then never again): 1. DevTools → Application → Service Workers → Unregister 2. DevTools → Application → Storage → Clear site data 3. Hard reload (Ctrl-Shift-R) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d37f37a36d
commit
613a925e45
8 changed files with 10 additions and 8 deletions
|
|
@ -15,7 +15,9 @@ export default defineConfig(({ mode }) => ({
|
|||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
devOptions: {
|
||||
enabled: true
|
||||
// SW disabled in dev — was caching stale bundles across restarts.
|
||||
// Run `npm run preview` to test PWA behaviour against a real build.
|
||||
enabled: false
|
||||
},
|
||||
// strategies: 'injectManifest',
|
||||
srcDir: 'public',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue