Files
shoottracker/frontend/vite.config.ts
T

55 lines
1.6 KiB
TypeScript

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/*.png', 'icons/*.svg'],
manifest: {
name: 'ShootTracker',
short_name: 'ShootTracker',
description: 'Suivi de performance en tir sportif',
theme_color: '#0d0d0d',
background_color: '#0d0d0d',
display: 'standalone',
orientation: 'portrait',
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: 'any maskable' }
]
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^\/api\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: 'shoottracker-api-cache',
expiration: { maxEntries: 50, maxAgeSeconds: 60 * 5 },
networkTimeoutSeconds: 10,
}
}
]
}
})
],
server: {
port: 5173,
proxy: {
'/api': { target: 'http://localhost:3001', changeOrigin: true },
'/uploads': { target: 'http://localhost:3001', changeOrigin: true }
}
},
build: {
outDir: 'dist',
sourcemap: false
}
})