From f18eeaaf69a2ed3db2266befeaa9d9a5a2a945ec Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 29 Apr 2025 10:54:10 +0800 Subject: [PATCH] perf: Load frontend resource --- backend/main.py | 3 ++- frontend/vite.config.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index 357e88b0..6a69bd9f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -45,11 +45,12 @@ if not os.path.exists(frontend_dist): logging.warning("Please make sure you have built the front-end project") else: - app.mount("/static", StaticFiles(directory=frontend_dist), name="static") @app.get("/", include_in_schema=False) async def read_index(): return FileResponse(path=os.path.join(frontend_dist, "index.html")) + + app.mount("/", StaticFiles(directory=frontend_dist), name="static") if __name__ == "__main__": import uvicorn diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 7e861bd3..eb7bfc93 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig(({ mode }) => { console.log(mode) console.log(env) return { + base: './', plugins: [ vue(), AutoImport({