-
Notifications
You must be signed in to change notification settings - Fork 42
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
[Bug] webpack 5 updated files do not trigger rebuilds #68
Comments
ok one issue is that https://github.com/sysgears/webpack-virtual-modules/blob/master/index.js#L65 is a |
More context, it's not the debugger its whether |
@jquense Yes, the new |
It seems that Webpack 5 watch support is currently incomplete CC @samcooke98 |
I've narrowed down the issue a bit. The core problem is that watchers are producing a map of timestamps that are missing the virtual files. basically on rebuilds this line: https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L737 nulls out the initial Basically the timestamp stays It should be said that this is a bug in v5, the value is a FileSystemInfoEntry object not just a timestamp. That will fix the problem for rebuilds after the first one. For the first recompile the |
An alternative approach here might be to wrap the WatchFileSystem directly, fixing up the map here: https://github.com/webpack/webpack/blob/master/lib/node/NodeWatchFileSystem.js#L80 would (i think) solve the problem and avoid dealing with the craziness of watchpack |
Yeah, I'm also looking at these |
We can call fileWatcher.directoryWatcher.setFileTime(
modulePath,
+time,
false,
false,
'change'
); it fixes the timing, but its not the end of the journey, it seems |
@jquense The fix published in |
Describe the bug
Here is a repo demostrating the issue: https://github.com/jquense/webpack-pitch-repro/tree/virtual-modules
It's a bit convoluted, but bear with me it mirrors a real use case. Basically a loader will produce a virtual file that is. If during a rebuild the file is updated it's emitted but the emitted file will not be rebuilt by webpack. The same is not true if you write out a real file.
To Reproduce
https://github.com/jquense/webpack-pitch-repro/tree/virtual-modules
run
yarn start
, open the page, see the text. Open index.js change the string inevil
and notice web pack rebuilds but the string doesn't update.Environment if relevant (please complete the following information):
The text was updated successfully, but these errors were encountered: