Refactor code and update environment type definitions.
- Consolidate type definitions in vite-env.d.ts - Update TypeScript include paths
This commit is contained in:
7
lightrag_webui/src/env.d.ts
vendored
7
lightrag_webui/src/env.d.ts
vendored
@@ -1,7 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_PROXY: string
|
||||
readonly VITE_API_ENDPOINTS: string
|
||||
readonly VITE_BACKEND_URL: string
|
||||
}
|
10
lightrag_webui/src/vite-env.d.ts
vendored
10
lightrag_webui/src/vite-env.d.ts
vendored
@@ -1 +1,11 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_PROXY: string
|
||||
readonly VITE_API_ENDPOINTS: string
|
||||
readonly VITE_BACKEND_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
|
@@ -26,5 +26,5 @@
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src", "vite.config.ts"]
|
||||
}
|
||||
|
@@ -18,14 +18,14 @@ export default defineConfig({
|
||||
emptyOutDir: true
|
||||
},
|
||||
server: {
|
||||
proxy: import.meta.env.VITE_API_PROXY === 'true' && import.meta.env.VITE_API_ENDPOINTS ?
|
||||
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' ?
|
||||
rewrite: endpoint === '/api' ?
|
||||
(path) => path.replace(/^\/api/, '') : undefined
|
||||
}
|
||||
])
|
||||
|
Reference in New Issue
Block a user