Refactor Vite configuration and add environment type definitions

- Removed local Vite config file
- Updated dev scripts to use default config
- Added env.d.ts for type definitions
- Enhanced Vite config with dynamic proxy
- Simplified build and dev script commands
This commit is contained in:
yangdx
2025-03-05 18:25:51 +08:00
parent 0ca7c0e230
commit 81b78bda76
4 changed files with 23 additions and 40 deletions

View File

@@ -16,5 +16,19 @@ export default defineConfig({
build: {
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
emptyOutDir: true
},
server: {
proxy: import.meta.env.VITE_API_PROXY === 'true' && import.meta.env.VITE_API_ENDPOINTS ?
Object.fromEntries(
import.meta.env.VITE_API_ENDPOINTS.split(',').map(endpoint => [
endpoint,
{
target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621',
changeOrigin: true,
rewrite: endpoint === '/api' ?
(path) => path.replace(/^\/api/, '') : undefined
}
])
) : {}
}
})