-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (51 loc) · 1.6 KB
/
vite.config.ts
File metadata and controls
53 lines (51 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/// <reference types="vitest" />
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { readFileSync } from 'fs';
const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'));
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, '.', '');
return {
server: {
port: 3000,
host: '0.0.0.0',
},
plugins: [
react()
],
define: {
// Map a generic AI key into `process.env.API_KEY` at build time.
// Set `API_KEY` in your `.env.local` (or another env) when running locally.
'process.env.API_KEY': JSON.stringify(env.API_KEY || env.AI_API_KEY || ''),
'__APP_VERSION__': JSON.stringify(packageJson.version),
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setup.ts',
css: true,
exclude: ['node_modules', 'dist', 'tests/e2e/**', 'functions/**'],
},
build: {
chunkSizeWarningLimit: 1000, // Increase warning limit to 1MB
rollupOptions: {
output: {
manualChunks: {
'vendor-react': ['react', 'react-dom'],
'vendor-firebase': ['firebase/app', 'firebase/auth', 'firebase/firestore', 'firebase/storage'],
'vendor-ui': ['lucide-react', 'recharts'],
'vendor-maps': ['leaflet', 'react-leaflet'],
'vendor-pdf': ['jspdf', 'html2canvas'],
'vendor-utils': ['date-fns', 'i18next', 'react-i18next']
}
}
}
}
};
});