Replies: 3 comments
-
get ChangedFile may become a problem if watcher is not reliable(watch-bug), if changedFile is not reliable, then we have to do full rebuild with cache, if so module build cache is crucial to HMR performance. |
Beta Was this translation helpful? Give feedback.
0 replies
-
How to be compatible with https://github.com/webpack/webpack-dev-middleware is also important here since we need to be compatible with webpack-builder in the future. |
Beta Was this translation helpful? Give feedback.
0 replies
-
seems missing webpack prior art explanation |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
HMR Design and Implementation
HMR, Hot Module Replacement, is a feature in front-end engineering that can greatly improve the development experience by re-rendering modified code in the browser without re-freshing the page.
This article will go through the process and technical details of HMR.
Basic concepts and processes
First, a brief overview of the HMR data passing process.
For some running front-end project.
WatchFileSystem
In the file listening section, it is necessary to take into account the circumstances under which the build logic will be retriggered, looking step by step at.
compiler.context
directory in its entirety and re-build any files in it when they change.It is also important to consider the types of file changes, which are divided into four categories here.
Rebuild in Bundler
TODO: increment build or only build changed files?
When you get the changed files, the build tool needs to rebuild them. Usually, to increase the speed of execution, Bundler will update in incremental builds, i.e. it will only build those modules that are affected, eventually getting the current build product and using that to compare with the previous product and get the modules that need to be updated.
Server
There are two main functions involved in the Server.
Runtime in Browser
In addition to getting the socket code for the updated file contents, the Runtime section also needs to handle the rebuilt chunk, which is divided into the following steps.
Test
What needs to be tested.
Other
import.meta.hot
Beta Was this translation helpful? Give feedback.
All reactions