Skip to content

Commit e5c8d22

Browse files
committed
fix: file dependencies should be normalize
1 parent 5ab080f commit e5c8d22

File tree

2 files changed

+4
-4
lines changed
  • crates/rspack_plugin_copy/src
  • tests/rspack-test/configCases/plugins/copy-plugin-file-dependencies

2 files changed

+4
-4
lines changed

crates/rspack_plugin_copy/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl CopyRspackPlugin {
255255
if matches!(from_type, FromType::Dir | FromType::Glob) {
256256
logger.debug(format!("added '{absolute_filename}' as a file dependency",));
257257

258-
file_dependencies.insert(absolute_filename.clone().into_std_path_buf());
258+
file_dependencies.insert(absolute_filename.clone().into_std_path_buf().normalize());
259259
}
260260

261261
// TODO cache
@@ -416,7 +416,7 @@ impl CopyRspackPlugin {
416416
}
417417
FromType::File => {
418418
logger.debug(format!("added '{abs_from}' as a file dependency"));
419-
file_dependencies.insert(abs_from.clone().into_std_path_buf());
419+
file_dependencies.insert(abs_from.clone().into_std_path_buf().normalize());
420420
context = abs_from.parent().unwrap_or(Utf8Path::new("")).into();
421421

422422
if dot_enable.is_none() {

tests/rspack-test/configCases/plugins/copy-plugin-file-dependencies/rspack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ module.exports = {
88
new CopyRspackPlugin({
99
patterns: [
1010
{
11-
from: path.join(__dirname, "public"),
12-
to: path.join(__dirname, "dist"),
11+
from: "./public"
1312
}
1413
]
1514
}),
1615
{
1716
apply(compiler) {
1817
compiler.hooks.done.tap("DonePlugin", (stats) => {
1918
for (const file of stats.compilation.fileDependencies) {
19+
// Verify that fileDependencies are always normalized
2020
expect(file).toBe(path.normalize(file));
2121
}
2222
});

0 commit comments

Comments
 (0)