-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.mjs
38 lines (37 loc) · 1.17 KB
/
vite.config.mjs
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
import basicSsl from '@vitejs/plugin-basic-ssl';
import react from '@vitejs/plugin-react';
import * as path from 'path';
import { defineConfig } from 'vite';
import EnvironmentPlugin from 'vite-plugin-environment';
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
plugins: [react(), basicSsl(), EnvironmentPlugin({ API_ROOT: '' })],
server: {
https: true,
proxy: {
'/api': {
target: 'https://localhost:7253',
changeOrigin: true,
secure: false,
ws: true,
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res) => {
console.info('Proxy Error', err);
});
proxy.on('proxyReq', (proxyReq, req, _res) => {
console.info('Proxy Send:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.info('Proxy Receive:', proxyRes.statusCode, req.url);
});
proxy.on('upgrade', (req, socket, head) => {
console.info('WebSocket Upgrade:', req.url);
});
},
},
},
},
});