fix: make addWatchFile()
work (fix #7024)
#9723
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
fixes #7024 by ensuring
addWatchFile
adds files to the module graphAdditional context
The intention of db4ba56 was to allow plugins to add files to the module graph via
addWatchFile()
so that changes to those files would cause HMR updates. However, for files without any ES imports, the import analysis returns early and the files passed toaddWatchFile()
inthis._addedImports
are never added to the graph. Checking for the existence ofthis._addedImports
fixes this.Additionally, the new
forceSkipImportAnalysis
flag is needed to mark the newly created modules as not needing additional analysis so that the HMR update can propogate (see #8898).I could try to add the tests from #4461 if they are still relevant.Cherry-picked the test from #4461 and verified that it fails without 33938a3.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).