-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
now that mtimes
has been removed from watchpack, how do we get all changed/removed files?
#4106
Comments
Sounds good, send a PR |
@sokra i think we should implement this in webpack@5 before stable release, can we move this in |
The PR was merged last year, but I think more docs would be great, as it seems like the change is only mentioned vaguely once in https://webpack.js.org/blog/2020-10-10-webpack-5-release/#new-watching, no other documentation.
Luckily I was able to figure it out - the tests were esp. helpful - and changed our usage of the plugin mentioned by @maxwoo-houzz
like so: class WatchRunPlugin {
apply(compiler) {
compiler.hooks.watchRun.tap('WatchRun', (comp) => {
if (comp.modifiedFiles) {
const changedFiles = Array.from(comp.modifiedFiles, (file) => `\n ${file}`).join('');
console.log('===============================');
console.log('FILES CHANGED:', changedFiles);
console.log('===============================');
}
});
}
} |
Yes, let's documented this |
We have 4 variables here:
|
for directories, I am seeing empty objects in
is there also anything like |
I done a
|
Feature request
What is the expected behavior?
It seems like the new version of WatchPack (v2.0.0) are getting rid of the
mtimes
variable. However, from my research it seems like that variable was the only way to get the list of changed files that triggered a re-compilation (source).As such, there should be an alternative way to get this list of changed files.
What is motivation or use case for adding/changing the behavior?
Seems like a pretty useful feature for the
watchRun
hook, as there are already a couple people (including me) that use it.How should this be implemented in your opinion?
Watchpack actually provides the info we need, in the variable
filesModified
that it passes to Watching.js. However, Watching.js doesn't use it at all. Ideally I think this variable should be provided in thewatchRun
hook, but it should also be fine to just store it as a property just like how it's done withremovedFiles
, eg in Watching.js:Are you willing to work on this yourself?
yes
The text was updated successfully, but these errors were encountered: