generated from google-gemini/aistudio-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathvite.config.ts
More file actions
35 lines (33 loc) · 1.03 KB
/
vite.config.ts
File metadata and controls
35 lines (33 loc) · 1.03 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
import path from 'path';
import { readFileSync } from 'fs';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'));
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
// 改用相對路徑,增加部署靈活性
base: '/MD2DOC-Evolution/',
server: {
port: 3000,
host: '0.0.0.0',
},
plugins: [react()],
define: {
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
__APP_VERSION__: JSON.stringify(packageJson.version),
},
build: {
chunkSizeWarningLimit: 1000, // 提高警告門檻至 1MB
rollupOptions: {
output: {
manualChunks: {
docx: ['docx'],
vendor: ['react', 'react-dom', 'lucide-react', 'file-saver'],
},
},
},
},
};
});