You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you delete the component you just added, first, webpack catch the unlink event immediately and tried to run HMR, but an linked module was missing so an error will be emitted soon, At the same time the chokidar catch the unlink event too, after several ms, temp files are re-generated, so webpack will update again, then the error disappeared. so the process is:
We're closing this issue as stale as it's more than 20 days without activity, and without an associated Pull Request. Please feel free to continue discussion. We'll reopen this issue if anything actionable is posted.
Summary
This issue was found by @meteorlxy at #348
Why having this bug?
Let me take a vue component file as an example.
chokidar
catch theadd
event, and re-generated the temp files. so the process is:unlink
event immediately and tried to run HMR, but an linked module was missing so an error will be emitted soon, At the same time thechokidar
catch theunlink
event too, after several ms, temp files are re-generated, so webpack will update again, then the error disappeared. so the process is:Workaround
Exclude the files at
docs/**
in webpack and addchange
event tochokidar
. then the process will be:But this solution has a side effect is that when you only typed some words,
update by chokidar
will be re-run.Ideal workaround
if
webpack
watchOptions can support conditional ignore, there will be a perfect fix:change
=> webpack HMRadd/unlink/addDir/unlinkDir
=> only update by chokidar (disable webpack HMR)I just checked the
watchpack
:https://github.com/webpack/watchpack/blob/8d839e8b6edb87f9cd8a1ff97028060c4ecc9bee/lib/DirectoryWatcher.js#L67-L72
And also checked webpack's docs / code but didn't find any approach.
cc @yyx990803
The text was updated successfully, but these errors were encountered: