fix: vite dev proxy 端口对齐 7500(支持 VITE_PROXY_TARGET 覆盖)

原指向 127.0.0.1:17650 与后端默认 -addr 127.0.0.1:7500 不符;同步 @types/node devDependency 并纳入 tsconfig
This commit is contained in:
2026-08-17 12:07:14 +08:00
parent 5237e3b594
commit 45346405c2
5 changed files with 35 additions and 13 deletions

View File

@ -1,14 +1,17 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'node:url'
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath } from "node:url";
// Backend default port (cmd/webui4frpc -addr). Override with VITE_PROXY_TARGET.
const backend = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7500";
// The frontend is served by the Go binary at / (embedded dist), and talks to
// the same origin via /api/manager/*.
export default defineConfig({
plugins: [vue()],
base: '/',
base: "/",
resolve: {
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
},
css: {
preprocessorOptions: {
@ -18,11 +21,11 @@ export default defineConfig({
},
},
build: {
outDir: 'dist',
outDir: "dist",
},
server: {
proxy: {
'/api': 'http://127.0.0.1:17650',
"/api": backend,
},
},
})
});