From 80952bd04796f84f070a603e02dbc9722a9dacc2 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Thu, 30 Jul 2026 09:41:37 +0200 Subject: [PATCH] fix: remove PWA service worker (was caching stale assets), add SW unregister --- frontend/src/main.tsx | 9 +++++++ frontend/vite.config.ts | 56 ----------------------------------------- 2 files changed, 9 insertions(+), 56 deletions(-) diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 7d27693..3ee1de3 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -4,6 +4,15 @@ import App from './App'; import './index.css'; import './i18n'; +// Unregister any existing PWA service workers (PWA disabled — was caching stale assets) +if ('serviceWorker' in navigator) { + navigator.serviceWorker.getRegistrations().then((registrations) => { + for (const reg of registrations) { + reg.unregister(); + } + }); +} + ReactDOM.createRoot(document.getElementById('root')!).render( diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 4c04528..4e1aba5 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,66 +1,10 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { resolve } from 'path'; -import { VitePWA } from 'vite-plugin-pwa'; export default defineConfig({ plugins: [ react(), - VitePWA({ - registerType: 'autoUpdate', - includeAssets: ['favicon.svg', 'icon-192.svg', 'icon-512.svg'], - manifest: { - name: 'LeoCRM', - short_name: 'LeoCRM', - description: 'Mini-CRM für kleine Unternehmen', - theme_color: '#2563eb', - background_color: '#ffffff', - display: 'standalone', - orientation: 'portrait', - scope: '/', - start_url: '/', - icons: [ - { - src: 'icon-192.svg', - sizes: '192x192', - type: 'image/svg+xml', - purpose: 'any maskable', - }, - { - src: 'icon-512.svg', - sizes: '512x512', - type: 'image/svg+xml', - purpose: 'any maskable', - }, - ], - }, - workbox: { - globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'], - runtimeCaching: [ - { - urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i, - handler: 'CacheFirst', - options: { - cacheName: 'google-fonts-cache', - expiration: { - maxEntries: 10, - maxAgeSeconds: 60 * 60 * 24 * 365, - }, - }, - }, - { - urlPattern: /\.(?:js|css|woff2?)$/i, - handler: 'StaleWhileRevalidate', - options: { - cacheName: 'static-resources', - }, - }, - ], - }, - devOptions: { - enabled: false, - }, - }), ], resolve: { alias: {