Skip to content

Commit 18d9ad6

Browse files
Copilothotlong
andcommitted
fix: use postinstall hook instead of node-linker=hoisted to fix Vercel symlinks
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/76ab0fdf-c767-4448-a46c-0d204f18f208
1 parent 3662ad9 commit 18d9ad6

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
auto-install-peers=false
2-
node-linker=hoisted

apps/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": {
88
"dev": "objectstack serve --dev",
99
"build": "tsc --noEmit",
10-
"start": "objectstack serve"
10+
"start": "objectstack serve",
11+
"postinstall": "node scripts/patch-symlinks.cjs"
1112
},
1213
"devDependencies": {
1314
"@hono/node-server": "^1.19.11",

apps/demo/scripts/patch-symlinks.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88
* "invalid deployment package … symlinked directories". This script
99
* replaces ALL top-level symlinks with real copies of the target
1010
* directories so that Vercel can bundle the serverless function.
11+
*
12+
* This script is invoked as a postinstall hook and is a no-op outside
13+
* the Vercel build environment (process.env.VERCEL is not set locally).
1114
*/
1215
'use strict';
1316

17+
// Only run during Vercel builds. Skip in local development to preserve
18+
// pnpm workspace symlinks for live-reload.
19+
if (!process.env.VERCEL) {
20+
process.exit(0);
21+
}
22+
1423
const fs = require('fs');
1524
const path = require('path');
1625

apps/demo/vercel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"api/**/*.ts": {
88
"memory": 1024,
99
"maxDuration": 60,
10-
"includeFiles": "{packages/*/dist,node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist}/**"
10+
"includeFiles": "{node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist,node_modules/@objectql/example-project-tracker/dist}/**"
1111
}
1212
},
1313
"rewrites": [

0 commit comments

Comments
 (0)