Skip to content

Commit ab6ad6a

Browse files
fix: remove TS stub after esbuild bundle to prevent Vercel ERR_MODULE_NOT_FOUND
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/0302d779-7522-4028-ae9c-50d58b9fa1e9 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent a249322 commit ab6ad6a

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
switched esbuild output from CJS to ESM (fixes `"type": "module"` conflict),
1515
and changed the output path from `api/index.js` to `api/[[...route]].js`.
1616
Updated rewrites to match: `/api/:path*``/api/[[...route]]`.
17+
Added post-bundle cleanup to remove the `.ts` stub so Vercel's
18+
`@vercel/node` builder uses the self-contained esbuild bundle instead of
19+
compiling the stub (which would fail with `ERR_MODULE_NOT_FOUND`).
1720
- **Studio CORS error on Vercel temporary/preview domains** — Changed
1821
`VITE_SERVER_URL` from hardcoded `https://play.objectstack.ai` to `""`
1922
(empty string / same-origin) in `vercel.json` so each deployment — including

apps/studio/scripts/build-vercel.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ cd apps/studio
2626

2727
# 2. Bundle API serverless function
2828
node scripts/bundle-api.mjs
29+
# Remove the TS source file so Vercel's @vercel/node builder uses the
30+
# pre-bundled JS directly. Without this, Vercel compiles the TS stub
31+
# itself, producing a thin re-export that references ../server/index —
32+
# a file that doesn't exist at runtime (ERR_MODULE_NOT_FOUND).
33+
rm -f "api/[[...route]].ts"
2934

3035
# 3. Copy Vite build output to public/ for static file serving
3136
rm -rf public

0 commit comments

Comments
 (0)