-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
59 lines (55 loc) · 1.43 KB
/
vite.config.js
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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const API_PROXY = process.env.VITE_API_PROXY || 'http://localhost:8180'
const API_WS_PROXY = API_PROXY.replace(/^http/, 'ws')
// https://vitejs.dev/config/
export default defineConfig({
base: '/', // Ensure this is set correctly, especially if you are deploying in a subpath
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
// Redirect API calls to API
server: {
https: {
key: 'ssl/server.key',
cert: 'ssl/server.crt',
},
// When needed, use: npm run dev -- --host
// host: true, // listen in all interfaces
proxy: {
"/login": {
target: API_PROXY,
changeOrigin: true,
secure: false,
},
"/api1/ws": {
target: API_WS_PROXY,
changeOrigin: true,
secure: false,
ws: true,
},
"/api1": {
target: API_PROXY,
changeOrigin: true,
secure: false,
},
// Redirects to different API endpoints
"/proxy/ws/": {
target: API_WS_PROXY,
changeOrigin: true,
secure: false,
ws: true,
},
"/proxy/": {
target: API_PROXY,
changeOrigin: true,
secure: false,
},
},
// logLevel: 'info', // Options are 'info', 'warn', 'error', or 'silent'
},
})