mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-02 04:53:40 +00:00
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
port: 3000,
|
|
strictPort: true, // Exit if port is already in use
|
|
allowedHosts: ['localhost'],
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
configure: process.env.VITE_ENABLE_LOGGING === 'true' ? (proxy, options) => {
|
|
proxy.on('error', (err, req, res) => {
|
|
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);
|
|
});
|
|
} : undefined,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: process.env.NODE_ENV !== 'production',
|
|
target: 'es2018',
|
|
},
|
|
})
|