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
1 change: 1 addition & 0 deletions src/presets/vercel/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ async function createFunctionDirWithCustomConfig(
await fsp.cp(serverDir, funcDir, {
recursive: true,
mode: constants.COPYFILE_FICLONE,
verbatimSymlinks: true,
filter: (src) => basename(src) !== ".vc-config.json",
});
const mergedConfig = defu(overrides, baseFunctionConfig);
Expand Down
11 changes: 11 additions & 0 deletions test/presets/vercel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,17 @@ describe("nitro:preset:vercel:web", async () => {
expect(indexStat.isFile()).toBe(true);
});

it("should preserve dependency symlink targets inside functionRules directories", async () => {
const dependencyPath = "node_modules/@fixture/nitro-lib";
const serverTarget = await fsp.readlink(
resolve(ctx.outDir, "functions/__server.func", dependencyPath)
);
const functionTarget = await fsp.readlink(
resolve(ctx.outDir, "functions/api/hello.func", dependencyPath)
);
expect(functionTarget).toBe(serverTarget);
});

it("should keep base __server.func without functionRules overrides", async () => {
const config = await fsp
.readFile(resolve(ctx.outDir, "functions/__server.func/.vc-config.json"), "utf8")
Expand Down
Loading