- 将 .env.example 中的 PORT 从 3001 更改为 3010 - 将 CORS_ORIGIN 从 http://localhost:5173 更改为 http://localhost:5180 - 更新 compose.yaml 中的服务端口和健康检查端口为 3010 - 修改 Dockerfile 中暴露的端口为 3010 - 更新文档中的 API 端口引用从 3001 到 3010 - 在 Vite 配置中设置开发服务器端口为 5180 - 更新 Vite 代理目标地址为 http://localhost:3010
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react({
|
|
babel: {
|
|
plugins: [
|
|
'react-dev-locator',
|
|
],
|
|
},
|
|
}),
|
|
tsconfigPaths(),
|
|
],
|
|
server: {
|
|
port: 5180,
|
|
strictPort: true,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3010',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
configure: (proxy) => {
|
|
proxy.on('error', (err) => {
|
|
console.log('proxy error', err);
|
|
});
|
|
proxy.on('proxyReq', (_proxyReq, req) => {
|
|
console.log('Sending Request to the Target:', req.method, req.url);
|
|
});
|
|
proxy.on('proxyRes', (proxyRes, req) => {
|
|
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
|
|
});
|
|
},
|
|
},
|
|
'/uploads': {
|
|
target: 'http://localhost:3010',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
}
|
|
}
|
|
}
|
|
})
|