From 137dd02e91e1b51ba85c35607887f37662fc4406 Mon Sep 17 00:00:00 2001 From: jingrow Date: Thu, 12 Mar 2026 00:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=9F=E4=BA=A7=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jingrow/frontend/vite.config.ts | 6 ++---- package.json | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/jingrow/frontend/vite.config.ts b/apps/jingrow/frontend/vite.config.ts index 190fc01..27aad87 100644 --- a/apps/jingrow/frontend/vite.config.ts +++ b/apps/jingrow/frontend/vite.config.ts @@ -54,8 +54,6 @@ export default defineConfig(({ mode, command }) => { const filesDir = command === 'serve' ? path.resolve(currentDir, '..', 'jingrow', 'public', 'files') : null return { - // 生产环境使用完整路径,开发环境使用根路径 - base: command === 'build' ? '/assets/jingrow/frontend/' : '/', plugins: [ vue(), Icons({ @@ -110,8 +108,8 @@ export default defineConfig(({ mode, command }) => { allow: [appsDir] }, proxy: { - // 使用正则批量匹配多个路由 - '^/(api|assets|files|private)': { + // jlocal 只代理 API 请求,静态资源由 vite/Caddy 直接托管 + '^/api': { target: BACKEND_URL, changeOrigin: true, secure: false, diff --git a/package.json b/package.json index fdb0704..aecb67d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "install:backend": "bash -lc 'cd apps/jingrow && if [ -f pyproject.toml ]; then uv sync; elif [ -f requirements.txt ]; then uv pip install -r requirements.txt; else echo \"No dependency manifest found\"; fi'", "build": "npm run build:frontend", "build:frontend": "cd apps/jingrow/frontend && npm run build", - "start": "npm run start:frontend && npm run start:backend", + "start": "concurrently --names \"BACKEND,FRONTEND\" --prefix-colors \"blue,green\" \"npm run start:backend\" \"sleep 3 && npm run start:frontend\"", "start:frontend": "cd apps/jingrow/frontend && npm run preview", "start:backend": "cd apps/jingrow && uv run uvicorn jingrow.main:app --host 0.0.0.0 --port 9001", "clean": "npm run clean:frontend && npm run clean:backend",