Initial commit: DataTool backend, frontend and Docker
This commit is contained in:
32
frontend/vite.config.ts
Normal file
32
frontend/vite.config.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import path from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
// 为 sockjs-client 等依赖提供浏览器环境下的 global 替代
|
||||
define: {
|
||||
global: 'window',
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
// 允许局域网内其它设备访问(如手机、其它电脑)
|
||||
host: true,
|
||||
// 开发时代理:前端用同源请求,由 Vite 转发到后端,跨设备访问时无需改 API 地址
|
||||
// xfwd: true 会把真实客户端 IP 写入 X-Forwarded-For,后端 /api/room/my-ip 才能拿到各机器的 IP
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
xfwd: true,
|
||||
},
|
||||
'/ws': { target: 'http://localhost:8080', ws: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user