Skip to content

Conversation

@larixer
Copy link
Member

@larixer larixer commented Oct 15, 2020

What's the problem this PR addresses?

Webpack 5 watch mode support is broken at the moment. Fixes: #68

How did you fix it?

I have added virtual files mtime propagation into new watchpack version.

setData(statStorage, file, createWebpackData(stats));
setData(fileStorage, file, createWebpackData(contents));
self._compiler.fileTimestamps instanceof Map &&
self._compiler.fileTimestamps.set(file, +stats.mtime);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't removing this cause issues for webpack 4?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileWatcher.directoryWatcher.setFileTime call added in this PR should work both for Webpack 4 and Webpack 5, at least, when I checked it worked for me, we lack proper automated tests now and they are hard to write, so yeah, if you noticed that this change breaks something, please open an issue.

syvb added a commit to syvb/svelte-loader that referenced this pull request Oct 21, 2020
@larixer larixer deleted the larixer/webpack5-watch branch October 22, 2020 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] webpack 5 updated files do not trigger rebuilds

2 participants