59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { resolve } from 'path';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
],
|
|
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')) return 'utils';
|
|
if (id.includes('zustand') || id.includes('immer')) return 'react-vendor';
|
|
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'],
|
|
},
|
|
},
|
|
});
|