Files
patriothacks/vite.config.ts
T

26 lines
887 B
TypeScript

import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
// Workbox-based service worker: precaches the app shell (HTML/JS/CSS
// bundle) for offline load. Manifest generation is intentionally left
// to the PWA-manifest todo (manifest: false here) so this config only
// owns the service worker, not index.html's manifest link.
VitePWA({
registerType: 'autoUpdate',
// Registration is done explicitly in src/main.tsx via the
// 'virtual:pwa-register' module, not auto-injected into index.html,
// so the shell root owns the registration call.
injectRegister: false,
manifest: false,
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
},
}),
],
})