修复生产环境无法启动前端的问题
This commit is contained in:
parent
829174439f
commit
137dd02e91
@ -54,8 +54,6 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
const filesDir = command === 'serve' ? path.resolve(currentDir, '..', 'jingrow', 'public', 'files') : null
|
const filesDir = command === 'serve' ? path.resolve(currentDir, '..', 'jingrow', 'public', 'files') : null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// 生产环境使用完整路径,开发环境使用根路径
|
|
||||||
base: command === 'build' ? '/assets/jingrow/frontend/' : '/',
|
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
Icons({
|
Icons({
|
||||||
@ -110,8 +108,8 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
allow: [appsDir]
|
allow: [appsDir]
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
// 使用正则批量匹配多个路由
|
// jlocal 只代理 API 请求,静态资源由 vite/Caddy 直接托管
|
||||||
'^/(api|assets|files|private)': {
|
'^/api': {
|
||||||
target: BACKEND_URL,
|
target: BACKEND_URL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
|
|||||||
@ -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'",
|
"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": "npm run build:frontend",
|
||||||
"build:frontend": "cd apps/jingrow/frontend && npm run build",
|
"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: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",
|
"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",
|
"clean": "npm run clean:frontend && npm run clean:backend",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user