From f438c482c38b6e79ccba072b23939b950763e97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E6=9D=A1=E5=9B=BA=E6=89=A7=E7=9A=84=E9=B1=BC?= <1504947133@qq.com> Date: Fri, 14 Aug 2026 18:32:16 +0800 Subject: [PATCH] fix(frontend): export Expo web so Vercel preview serves HTML Vercel was publishing frontend source and serving index.ts as video/mp2t, so preview links downloaded a file instead of opening the app. --- .github/workflows/ci.yml | 5 ++++- frontend/.gitignore | 1 + frontend/app.json | 7 ++++++- frontend/package.json | 3 ++- frontend/vercel.json | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 frontend/vercel.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d836b52e..7826660a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,5 +138,8 @@ jobs: - name: Checks (lint, format, typecheck) run: npm run check - - name: Export build + - name: Export Android build run: npx expo export --platform android --output-dir dist + + - name: Export Web build + run: npx expo export --platform web --output-dir dist-web && test -f dist-web/index.html diff --git a/frontend/.gitignore b/frontend/.gitignore index bd701e15..96403d63 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -6,6 +6,7 @@ node_modules/ # Expo .expo/ dist/ +dist-web/ web-build/ expo-env.d.ts diff --git a/frontend/app.json b/frontend/app.json index d1242021..bf7d4921 100644 --- a/frontend/app.json +++ b/frontend/app.json @@ -29,6 +29,11 @@ ], "package": "com.anonymous.timeflow" }, - "plugins": ["expo-sqlite", "expo-location", "@irvingouj/expo-audio-stream"] + "plugins": ["expo-sqlite", "expo-location", "@irvingouj/expo-audio-stream"], + "web": { + "bundler": "metro", + "output": "single", + "favicon": "./assets/icon.png" + } } } diff --git a/frontend/package.json b/frontend/package.json index a8e99ea7..99862b16 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -47,6 +47,7 @@ "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", + "export:web": "expo export --platform web --output-dir dist", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write .", @@ -58,7 +59,7 @@ "typecheck": "tsc --noEmit", "check": "npm run lint && npm run format:check && npm run typecheck && npm run test", "postinstall": "patch-package", - "verify:ci": "npm run check && expo export --platform android --output-dir dist" + "verify:ci": "npm run check && expo export --platform android --output-dir dist && expo export --platform web --output-dir dist-web" }, "private": true, "jest": { diff --git a/frontend/vercel.json b/frontend/vercel.json new file mode 100644 index 00000000..992e0621 --- /dev/null +++ b/frontend/vercel.json @@ -0,0 +1,14 @@ +{ + "buildCommand": "npx expo export -p web", + "outputDirectory": "dist", + "installCommand": "npm ci", + "devCommand": "npx expo start --web", + "cleanUrls": true, + "framework": null, + "rewrites": [ + { + "source": "/:path*", + "destination": "/" + } + ] +}