import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from 'path' // Windows 环境下的 Vite 配置 export default defineConfig({ plugins: [react()], resolve: { alias: { '@': path.resolve(__dirname, './src'), }, }, server: { host: '0.0.0.0', port: 4173, proxy: { '/rest': { target: 'http://localhost:5678', changeOrigin: true, secure: false, configure: (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); }); }, }, '/webhook': { target: 'http://localhost:5678', changeOrigin: true, secure: false, }, '/webhook-test': { target: 'http://localhost:5678', changeOrigin: true, secure: false, } } }, build: { outDir: 'dist', sourcemap: true, } })