Skip to content

Commit 8da7910

Browse files
Copilothotlong
andcommitted
fix: dereference nested symlinks in patch-symlinks.cjs to fix Vercel serverless bundling
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/4ce080f7-77be-4e30-94b4-10cf3d7fdb63
1 parent 8b2f70a commit 8da7910

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/demo/scripts/patch-symlinks.cjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ function derefSymlink(pkgPath) {
3434
const realPath = fs.realpathSync(abs);
3535
console.log(` → Dereferencing ${pkgPath}`);
3636

37-
// Copy to a temp location first, then swap — avoids data loss if cpSync fails
37+
// Copy to a temp location first, then swap — avoids data loss if cpSync fails.
38+
// dereference:true ensures nested pnpm .pnpm-store symlinks inside the package
39+
// are also resolved to real files, which is required by Vercel's function bundler.
3840
const tmpPath = abs + '.tmp';
39-
fs.cpSync(realPath, tmpPath, { recursive: true });
41+
fs.cpSync(realPath, tmpPath, { recursive: true, dereference: true });
4042
fs.unlinkSync(abs);
4143
fs.renameSync(tmpPath, abs);
4244
return true;

0 commit comments

Comments
 (0)