Files
bea-edit/vite.config.ts
rehlert f09384d2e6 pwa / offline mode
- @vite-pwa/sveltekit: workbox precache (incl. pdfjs worker), generated manifest, prompt-style updates via PwaUpdatePrompt toast
- prerendered routes for offline navigation, PWA icons, theme-color + apple-touch-icon
- pwa offline/update e2e suite (pnpm test:pwa, playwright.pwa.config.ts)
- datenschutz: offline/install section; prettier cleanup of shadcn components
2026-10-04 12:55:46 +02:00

66 lines
2.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import tailwindcss from '@tailwindcss/vite';
import adapter from '@sveltejs/adapter-node';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
tailwindcss(),
sveltekit({
compilerOptions: {
// Force runes mode for the project, except for libraries. Can be removed in svelte 6.
runes: ({ filename }) =>
filename.split(/[/\\]/).includes('node_modules') ? undefined : true
},
adapter: adapter()
}),
SvelteKitPWA({
registerType: 'prompt',
injectRegister: false,
manifest: {
name: 'beA-Edit',
short_name: 'beA-Edit',
description:
'PDF-Werkzeuge für die beA-Kanzlei – PDFs werden vollständig lokal im Browser verarbeitet.',
display: 'standalone',
orientation: 'any',
lang: 'de',
dir: 'ltr',
start_url: '/',
scope: '/',
categories: ['productivity', 'utilities'],
background_color: '#eef4f6',
theme_color: '#122f62',
icons: [
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
{
src: '/icons/icon-maskable-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
]
},
workbox: {
// The plugin prepends `client/` and `prerendered/` paths itself; extending the
// default list only adds the local font files and the pdfjs worker chunk (`*.mjs`,
// 2.1 MB, required to render PDFs offline). `client/Nunito/**` is the unused font
// drop from `static/` and would add 2.6 MB to the precache.
globPatterns: ['client/**/*.{js,mjs,css,ico,png,svg,webp,webmanifest,woff2,ttf}'],
globIgnores: ['client/Nunito/**'],
// Prerendered route documents (see src/routes/+layout.ts) are precached, so an
// offline navigation to any visited route — and any unknown path via the
// fallback — is served from the cache.
navigateFallback: '/',
maximumFileSizeToCacheInBytes: 8 * 1024 * 1024
},
// The service worker is only produced for production builds; `pnpm dev` never
// registers one, which keeps development caches clean.
devOptions: { enabled: false }
})
]
});