Skip to content
Merged
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
3 changes: 2 additions & 1 deletion e2e/helper/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
execSync,
exec as nodeExec,
} from 'node:child_process';
import { promises } from 'node:fs';
import { constants as fsConstants, promises } from 'node:fs';
import path from 'node:path';
import base, { expect } from '@playwright/test';
import fse from 'fs-extra';
Expand Down Expand Up @@ -302,6 +302,7 @@ export const test = base.extend<RsbuildFixture>({
await fse.remove(targetDir);
await promises.cp(path.join(cwd, 'src'), targetDir, {
recursive: true,
mode: fsConstants.COPYFILE_FICLONE,
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mode parameter with COPYFILE_FICLONE is intended for fs.copyFile(), not fs.promises.cp(). When using fs.promises.cp() with recursive: true for directory copying, the mode parameter controls file permissions, not copy behavior flags. This could cause test failures on filesystems that don't support copy-on-write. Consider removing this option to ensure test stability across different environments.

Suggested change
mode: fsConstants.COPYFILE_FICLONE,

Copilot uses AI. Check for mistakes.
});
return targetDir;
};
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/plugins/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ export const pluginServer = (): RsbuildPlugin => ({
});
}

return fs.promises.cp(publicDir, distPath, {
await fs.promises.cp(publicDir, distPath, {
recursive: true,
// dereference symlinks
dereference: true,
mode: fs.constants.COPYFILE_FICLONE,
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mode parameter with COPYFILE_FICLONE is intended for fs.copyFile(), not fs.promises.cp(). When using fs.promises.cp() with recursive: true for directory copying, the mode parameter controls file permissions, not copy behavior flags. Using COPYFILE_FICLONE here may cause the copy operation to fail on filesystems that don't support copy-on-write, or may not have the intended effect. Consider removing this option or handling filesystem compatibility errors explicitly in the catch block.

Suggested change
mode: fs.constants.COPYFILE_FICLONE,

Copilot uses AI. Check for mistakes.
});
}),
);
Expand Down
Loading