Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/vercel-symlink-eexist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-vercel': patch
---

fix: ignore `EEXIST` errors when symlinking traced files that resolve to the same destination
8 changes: 7 additions & 1 deletion packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,13 @@ async function create_function_bundle(builder, entry, dir, config) {

if (source !== realpath) {
const realdest = path.join(dir, path.relative(ancestor, realpath));
fs.symlinkSync(path.relative(path.dirname(dest), realdest), dest, is_dir ? 'dir' : 'file');
try {
fs.symlinkSync(path.relative(path.dirname(dest), realdest), dest, is_dir ? 'dir' : 'file');
} catch (error) {
// different traced paths can resolve to the same destination
// (e.g. multiple pnpm symlink chains pointing at the same real file)
if (/** @type {NodeJS.ErrnoException} */ (error).code !== 'EEXIST') throw error;
}
} else if (!is_dir) {
fs.copyFileSync(source, dest);
}
Expand Down
Loading