36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3005',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
configure: (proxy, _options) => {
|
|
proxy.on('error', (err, _req, _res) => {
|
|
// Suppress anticipated connection errors during stream reset/page reload
|
|
if ((err as any).code === 'ECONNRESET' || (err as any).code === 'ECONNABORTED') {
|
|
return;
|
|
}
|
|
console.log('proxy error', err);
|
|
});
|
|
proxy.on('proxyReq', (_proxyReq, _req, _res) => {
|
|
// console.log('Sending Request to the Target:', req.method, req.url);
|
|
});
|
|
proxy.on('proxyRes', (_proxyRes, _req, _res) => {
|
|
// console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
|
|
});
|
|
},
|
|
},
|
|
'/uploads': {
|
|
target: 'http://localhost:3005',
|
|
changeOrigin: true,
|
|
},
|
|
}
|
|
}
|
|
})
|