The service worker was intercepting iframe navigation to app paths
(/notices/, /kitchen/ etc.) and serving the portal's cached index.html
before the request reached nginx — causing the 🚧 EmbeddedFallback.
Only apply the fallback to portal routes; everything else goes to network.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
manifest: {
|
|
name: 'HNF Manage',
|
|
short_name: 'Manage',
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'standalone',
|
|
theme_color: '#0f1f35',
|
|
background_color: '#0f1f35',
|
|
icons: [
|
|
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
|
|
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
|
|
],
|
|
},
|
|
workbox: {
|
|
navigateFallback: '/index.html',
|
|
// Only apply the navigation fallback to the portal's own routes.
|
|
// App sub-paths (/notices/, /kitchen/, etc.) must reach nginx so
|
|
// the portal nginx can proxy them to the correct app container.
|
|
navigateFallbackAllowlist: [/^\/($|login|app\/|admin\/)/],
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
|
|
},
|
|
}),
|
|
],
|
|
})
|