2026-06-29 07:55:47 +02:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
import { resolve } from 'path';
|
2026-07-24 00:01:53 +02:00
|
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
2026-06-29 07:55:47 +02:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
2026-07-24 00:01:53 +02:00
|
|
|
plugins: [
|
|
|
|
|
react(),
|
|
|
|
|
VitePWA({
|
|
|
|
|
registerType: 'autoUpdate',
|
|
|
|
|
includeAssets: ['favicon.svg', 'icon-192.svg', 'icon-512.svg'],
|
|
|
|
|
manifest: {
|
|
|
|
|
name: 'LeoCRM',
|
|
|
|
|
short_name: 'LeoCRM',
|
|
|
|
|
description: 'Mini-CRM für kleine Unternehmen',
|
|
|
|
|
theme_color: '#2563eb',
|
|
|
|
|
background_color: '#ffffff',
|
|
|
|
|
display: 'standalone',
|
|
|
|
|
orientation: 'portrait',
|
|
|
|
|
scope: '/',
|
|
|
|
|
start_url: '/',
|
|
|
|
|
icons: [
|
|
|
|
|
{
|
|
|
|
|
src: 'icon-192.svg',
|
|
|
|
|
sizes: '192x192',
|
|
|
|
|
type: 'image/svg+xml',
|
|
|
|
|
purpose: 'any maskable',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
src: 'icon-512.svg',
|
|
|
|
|
sizes: '512x512',
|
|
|
|
|
type: 'image/svg+xml',
|
|
|
|
|
purpose: 'any maskable',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
workbox: {
|
|
|
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
|
|
|
|
|
runtimeCaching: [
|
|
|
|
|
{
|
|
|
|
|
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
|
|
|
|
handler: 'CacheFirst',
|
|
|
|
|
options: {
|
|
|
|
|
cacheName: 'google-fonts-cache',
|
|
|
|
|
expiration: {
|
|
|
|
|
maxEntries: 10,
|
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
urlPattern: /\.(?:js|css|woff2?)$/i,
|
|
|
|
|
handler: 'StaleWhileRevalidate',
|
|
|
|
|
options: {
|
|
|
|
|
cacheName: 'static-resources',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
devOptions: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
2026-06-29 07:55:47 +02:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': resolve(__dirname, 'src'),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
|
|
|
|
target: 'http://localhost:8000',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-07-23 12:00:34 +02:00
|
|
|
build: {
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
manualChunks(id) {
|
|
|
|
|
if (id.includes('node_modules')) {
|
|
|
|
|
if (id.includes('react-router')) return 'react-vendor';
|
|
|
|
|
if (id.includes('react-dom')) return 'react-vendor';
|
|
|
|
|
if (id.includes('/react/') || id.includes('\\react\\')) return 'react-vendor';
|
|
|
|
|
if (id.includes('@tanstack')) return 'tanstack';
|
|
|
|
|
if (id.includes('lucide-react') || id.includes('date-fns') || id.includes('clsx')) return 'ui';
|
|
|
|
|
if (id.includes('i18next') || id.includes('react-i18next')) return 'i18n';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-06-29 07:55:47 +02:00
|
|
|
test: {
|
|
|
|
|
globals: true,
|
|
|
|
|
environment: 'jsdom',
|
|
|
|
|
setupFiles: 'src/test/setup.ts',
|
|
|
|
|
css: true,
|
|
|
|
|
coverage: {
|
|
|
|
|
provider: 'v8',
|
|
|
|
|
reporter: ['text', 'json-summary'],
|
|
|
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
|
|
|
exclude: ['src/test/**', 'src/**/*.d.ts', 'src/main.tsx'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|