Skip to content
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

Adds Webpack 5 watch mode support #69

Merged
merged 1 commit into from
Oct 15, 2020
Merged

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.

@@ -188,8 +202,6 @@ VirtualModulesPlugin.prototype.apply = function(compiler) {
this._virtualFiles[file] = {stats: stats, contents: contents};
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