fix: scope PWA service workers to prevent cross-app interference
When multiple SPAs share the same origin (e.g., /sortir/ and /castle/ on demo.aiolabs.dev), their service workers conflict. Each app's workbox now scopes its navigateFallback with navigateFallbackAllowlist, and the main app excludes standalone paths via navigateFallbackDenylist. - Main app: denylist /sortir/ and /castle/ from its service worker - Sortir: allowlist only /sortir/ paths, fallback to activities.html - Castle: allowlist only /castle/ paths, fallback to castle.html - Icon paths use relative URLs (work with any base path) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
87f649f048
commit
7181b55d52
3 changed files with 21 additions and 10 deletions
|
|
@ -23,7 +23,9 @@ export default defineConfig(({ mode }) => ({
|
|||
workbox: {
|
||||
globPatterns: [
|
||||
'**/*.{js,css,html,ico,png,svg}'
|
||||
]
|
||||
],
|
||||
// Don't intercept standalone app paths — they have their own service workers
|
||||
navigateFallbackDenylist: [/^\/sortir\//, /^\/castle\//],
|
||||
},
|
||||
includeAssets: [
|
||||
'favicon.ico',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue