forked from siteboon/claudecodeui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
executable file
·70 lines (66 loc) · 2.26 KB
/
Copy pathvite.config.js
File metadata and controls
executable file
·70 lines (66 loc) · 2.26 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js'
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
const env = loadEnv(mode, process.cwd(), '')
const configuredHost = env.HOST || '0.0.0.0'
// if the host is not a loopback address, it should be used directly.
// This allows the vite server to EXPOSE all interfaces when the host
// is set to '0.0.0.0' or '::', while still using 'localhost' for browser
// URLs and proxy targets.
const host = normalizeLoopbackHost(configuredHost)
const proxyHost = getConnectableHost(configuredHost)
// TODO: Remove support for legacy PORT variables in all locations in a future major release, leaving only SERVER_PORT.
const serverPort = env.SERVER_PORT || env.PORT || 3001
return {
plugins: [react()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host,
port: parseInt(env.VITE_PORT) || 5173,
proxy: {
'/api': `http://${proxyHost}:${serverPort}`,
'/ws': {
target: `ws://${proxyHost}:${serverPort}`,
ws: true
},
'/shell': {
target: `ws://${proxyHost}:${serverPort}`,
ws: true
},
'/plugin-ws': {
target: `ws://${proxyHost}:${serverPort}`,
ws: true
}
}
},
build: {
outDir: 'dist',
chunkSizeWarningLimit: 1000,
rollupOptions: {
output: {
manualChunks: {
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
'vendor-codemirror': [
'@uiw/react-codemirror',
'@codemirror/lang-css',
'@codemirror/lang-html',
'@codemirror/lang-javascript',
'@codemirror/lang-json',
'@codemirror/lang-markdown',
'@codemirror/lang-python',
'@codemirror/theme-one-dark'
],
'vendor-xterm': ['@xterm/xterm', '@xterm/addon-fit', '@xterm/addon-clipboard', '@xterm/addon-webgl']
}
}
}
}
}
})