forked from houjiazong/llm-alchemist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
34 lines (32 loc) · 889 Bytes
/
vite.config.ts
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
import { defineConfig } from 'vite'
import path from 'node:path'
import react from '@vitejs/plugin-react'
import fs from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
export default defineConfig(async ({ command }) => {
let server = {}
if (command === 'serve') {
const devProxyConfigPath = fileURLToPath(
new URL('./dev.proxy.config.js', import.meta.url)
)
try {
await fs.access(devProxyConfigPath)
const devProxyConfig = await import(devProxyConfigPath)
server = {
proxy: devProxyConfig.default,
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
console.log('No proxy configuration found, skipping proxy setup.')
}
}
return {
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server,
}
})