From 7b58fd9a89e9b29578b30cb3119453e78e036ec2 Mon Sep 17 00:00:00 2001 From: Alexander Akait Date: Thu, 19 Nov 2020 19:12:27 +0300 Subject: [PATCH] fix: watching directories (#558) --- src/index.js | 4 ++-- test/__snapshots__/CopyPlugin.test.js.snap | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 488d53c5..1b9bc430 100644 --- a/src/index.js +++ b/src/index.js @@ -351,8 +351,8 @@ class CopyPlugin { force: pattern.force, }; - // If this came from a glob, add it to the file dependencies - if (pattern.fromType === "glob") { + // If this came from a glob or dir, add it to the file dependencies + if (pattern.fromType === "dir" || pattern.fromType === "glob") { compilation.fileDependencies.add(absoluteFilename); logger.debug(`added '${absoluteFilename}' as a file dependency`); diff --git a/test/__snapshots__/CopyPlugin.test.js.snap b/test/__snapshots__/CopyPlugin.test.js.snap index b37e63fc..6f28f0a0 100644 --- a/test/__snapshots__/CopyPlugin.test.js.snap +++ b/test/__snapshots__/CopyPlugin.test.js.snap @@ -176,6 +176,10 @@ exports[`CopyPlugin logging should logging when "from" is a directory: logs 1`] Object { "logs": Array [ "added './fixtures/directory' as a context dependency", + "added './fixtures/directory/.dottedfile' as a file dependency", + "added './fixtures/directory/directoryfile.txt' as a file dependency", + "added './fixtures/directory/nested/deep-nested/deepnested.txt' as a file dependency", + "added './fixtures/directory/nested/nestedfile.txt' as a file dependency", "begin globbing './fixtures/directory/**/*'...", "determined './fixtures/directory' is a directory", "determined that './fixtures/directory/.dottedfile' should write to '.dottedfile'",