copy-webpack-plugin: Watch mode not working correctly for certain filetypes

  • Operating System: Windows 10
  • Node Version: 10.12.0
  • NPM Version: 6.4.1
  • webpack Version: 4.29.6
  • copy-webpack-plugin Version: 5.0.0

Expected Behavior

  • Files that are copied by this plugin should be watched & recopied when they are modified.
  • Copied directories should watch for new/deleted files
  • Globs should watch for new files matching it. The copy-and-watch npm module does this already by watching the parent directory and copying any files that match the glob. (Linking to a specific commit in my own fork because it actually works there, and in my opinion it’s more readable before I had to reformat because of lint settings.)

Actual Behavior

At first I thought copied files weren’t watched at all, but after some headaches I found out that it’s just files without a webpack loader. json files are copied, ejs files aren’t.

To add salt to injury, in my own project these “no-loader” files got copied sometimes when I modified another file that did have a loader first and if they were copied by a glob, and then it still only worked once for some reason. However I wasn’t able to reproduce this behavior in my reproducing-repository (it might have something to do with the context option). For now I think we should focus on making it work in a not-complicated environment, if the issue persists after that I’ll look into it more extensively.

As far as I can tell the copyUnmodified option doesn’t change anything.

Code

I’ve created a reproducing repository here, for my own project is private.

How Do We Reproduce?

  • Clone aforementioned repository
  • Run npx webpack --watch
  • Modify one of the ejs files or create a new file in the assets directory
  • Observe the absence of a build trigger

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 84 (44 by maintainers)

Most upvoted comments

Great, release today

@evilebottnawi Отправил на почту she…@gmail.com

I can reproduce the bug on Windows 10 using HoldYourWaffle’s example repository. When I run npx webpack -w, all files are copied. However, all changes that I do at runtime are ignored.

I’m using almost the same system as HoldYourWaffle:

  • Operating System: Windows 10 (Version: 1607, Build: 14393.2759)
  • Node Version: 10.15.0
  • NPM Version: 6.4.1

@evilebottnawi What further information could help?

I re-cloned the repository I made, and I can with 100% certainty say that it does reproduce the issue on my machine. Perhaps it’s a platform specific issue?

I checked with logLevel: trace and found the following:

  • The file does get 'added for tracking content changes`
  • But this does not actually work. Modifying the file does not trigger any log message.

I would upload the log, but I don’t think you’re going to see anything exciting (mainly the lack of messages).

@gewisser Are you able to reproduce the issue with the repository I provided?