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'",