This commit is contained in:
2026-07-10 22:57:16 +02:00
commit c4a692b5d2
66 changed files with 4666 additions and 0 deletions

57
frontend/vite.config.js Normal file
View File

@@ -0,0 +1,57 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['icons/icon-192.png', 'icons/icon-512.png'],
manifest: {
name: 'KtoCo - Wydatki wspólne',
short_name: 'KtoCo',
description: 'Dzielenie wydatków dla par i współlokatorów',
theme_color: '#4f46e5',
background_color: '#ffffff',
display: 'standalone',
start_url: '/',
icons: [
{ src: 'icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: 'icons/icon-512.png', sizes: '512x512', type: 'image/png' },
{ src: 'icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
],
},
workbox: {
navigateFallbackDenylist: [/^\/api\//],
runtimeCaching: [
{
urlPattern: ({ url }) => url.pathname.startsWith('/api/') && url.pathname !== '/api/expenses',
handler: 'NetworkFirst',
method: 'GET',
options: {
cacheName: 'api-get-cache',
networkTimeoutSeconds: 4,
expiration: { maxEntries: 100, maxAgeSeconds: 7 * 24 * 60 * 60 },
},
},
{
urlPattern: ({ url }) => url.pathname === '/api/expenses',
handler: 'NetworkFirst',
method: 'GET',
options: { cacheName: 'api-expenses-cache', networkTimeoutSeconds: 4 },
},
],
},
}),
],
server: {
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
});