import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa' // https://vite.dev/config/ export default defineConfig({ plugins: [ react(), VitePWA({ registerType: 'autoUpdate', includeAssets: ['favicon.svg', 'robots.txt', 'apple-touch-icon.png'], manifest: { name: 'FlowReader', short_name: 'FlowReader', description: 'Lecteur RSS minimaliste et rapide', theme_color: '#166534', background_color: '#166534', display: 'standalone', icons: [ { src: 'favicon.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any maskable' } ] }, workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg}'], runtimeCaching: [ { urlPattern: /^https:\/\/images\.unsplash\.com\/.*/i, handler: 'CacheFirst', options: { cacheName: 'unsplash-images', expiration: { maxEntries: 50, maxAgeSeconds: 60 * 60 * 24 * 30, // 30 Days }, cacheableResponse: { statuses: [0, 200], }, }, }, { urlPattern: /\/api\/v1\/.*/i, handler: 'NetworkFirst', options: { cacheName: 'api-cache', expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24, // 24 Hours }, }, }, ], }, }) ], server: { port: 5173, proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, }, }, }, })