aaa7406929
HIGH (Performance):
- Replace 8 sync file operations with aiofiles in async context (storage, mail,
report_generator, dms_bridge, ai_assistant)
- Frontend bundle splitting: manualChunks for react-vendor, ui-components, tanstack,
markdown, icons, utils, i18n (ui chunk 936K → ~19K)
MEDIUM (Architecture):
- Worker circular deps: Replace direct plugin imports with job_registry.py pattern
(register_job/get_all_jobs, importlib-based lazy loading)
- App-wide ErrorBoundary: New ErrorBoundary.tsx component, wrapped in AppShell
and all standalone routes
LOW (Code Quality):
- N+1 query fix: selectinload(Contact.contact_persons) in list_contacts()
- O(n²) dedup fix: SQL GROUP BY for email/phone duplicates, Dict-based name grouping
- Response format standardization: 7 routes converted from plain arrays to
{items: [...], total: N} format
114 lines
3.2 KiB
TypeScript
114 lines
3.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { resolve } from 'path';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
export default defineConfig({
|
|
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,
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
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')) return 'icons';
|
|
if (id.includes('react-markdown') || id.includes('remark-gfm')) return 'markdown';
|
|
if (id.includes('date-fns') || id.includes('clsx') || id.includes('class-variance-authority') || id.includes('tailwind-merge') || id.includes('zustand') || id.includes('immer')) return 'utils';
|
|
if (id.includes('i18next') || id.includes('react-i18next')) return 'i18n';
|
|
}
|
|
// Split @/components/ui into its own chunk
|
|
if (id.includes('/src/components/ui/')) {
|
|
return 'ui-components';
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
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'],
|
|
},
|
|
},
|
|
});
|