managarten/apps/todo/apps/web/vite.config.ts
Till JS 9bdb997394 refactor(pwa): replace custom service workers with Vite PWA plugin and centralize offline page
Remove hand-written sw.js, offline.html, and manifest.json from todo/skilltree/zitare web apps
in favor of the Workbox-based service worker generated by @vite-pwa/sveltekit. This fixes an
issue where the custom SW could get stuck serving the offline fallback page even when the server
was reachable. Also extracts the duplicated offline page (~80 lines each across 19 apps) into a
shared OfflinePage component in @manacore/shared-ui with 3 props (appName, offlineMessage,
accentColor), reducing each app's offline route to an 8-line wrapper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 18:16:43 +01:00

60 lines
1.4 KiB
TypeScript

/// <reference types="vitest/config" />
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import { createPWAConfig } from '@manacore/shared-pwa';
import { MANACORE_SHARED_PACKAGES, getBuildDefines } from '@manacore/shared-vite-config';
export default defineConfig({
plugins: [
tailwindcss(),
sveltekit(),
SvelteKitPWA(
createPWAConfig({
name: 'Todo - Aufgabenverwaltung',
shortName: 'Todo',
description: 'Aufgaben und Projekte verwalten mit Kanban-Board, Subtasks und mehr',
themeColor: '#8b5cf6',
shortcuts: [
{
name: 'Neue Aufgabe',
short_name: 'Neu',
description: 'Neue Aufgabe erstellen',
url: '/?action=new',
},
{
name: 'Kanban Board',
short_name: 'Kanban',
description: 'Kanban-Ansicht öffnen',
url: '/kanban',
},
{
name: 'Einstellungen',
short_name: 'Settings',
description: 'App-Einstellungen öffnen',
url: '/settings',
},
],
})
),
],
server: {
port: 5188,
strictPort: true,
},
ssr: {
noExternal: [...MANACORE_SHARED_PACKAGES, '@todo/shared'],
},
optimizeDeps: {
exclude: [...MANACORE_SHARED_PACKAGES, '@todo/shared'],
},
test: {
environment: 'jsdom',
include: ['src/**/*.test.ts'],
globals: true,
},
define: {
...getBuildDefines(),
},
});