Skip to content

Commit 2d53268

Browse files
authored
Merge pull request #523 from bonham000/patch-7
Update hot-module-replacement.md
2 parents c65610d + f9cadbf commit 2d53268

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/concepts/hot-module-replacement.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@ In addition to the normal assets the compiler need to emit the "Update" to allow
2424

2525
The manifest contains the new compilation hash and a list of all update chunks (2.).
2626

27-
The update chunks contains code for all updated modules in this chunk (or a flag if a module was removed).
27+
The update chunks contain code for all updated modules in this chunk (or a flag if a module was removed).
2828

29-
The compiler addtionally makes sure that module and chunk ids as consistent between these builds. It uses a "records" json file to store them between builds (on it store them in memory).
29+
The compiler addtionally makes sure that module and chunk ids are consistent between these builds. It uses a "records" json file to store them between builds (or it stores them in memory).
3030

3131
### From The Module View
3232

3333
HMR is an opt-in feature, so it only affects modules that contains HMR code. The documentation describes the API that is available in modules. In general the module developer writes handlers that are called when a dependency of this module is updated. The developer can also write a handler that is called when this module is updated.
3434

35-
In most cases it's not mandatory to write HMR code in every module. If a module has no HMR handlers the update bubbles up. This means a single handler can handle a update to a complete module tree. If a single module in this tree is updated, the complete module tree is reloaded (only reloaded not transferred).
35+
In most cases it's not mandatory to write HMR code in every module. If a module has no HMR handlers the update bubbles up. This means a single handler can handle an update to a complete module tree. If a single module in this tree is updated, the complete module tree is reloaded (only reloaded not transferred).
3636

3737
### From The HMR Runtime View (Technical)
3838

39-
For the module system runtime is additional code emitted to track module `parents` and `children`.
39+
For the module system runtime additional code is emitted to track module `parents` and `children`.
4040

4141
On the management side the runtime supports two methods: `check` and `apply`.
4242

4343
A `check` does a HTTP request to the update manifest. When this request fails, there is no update available. Elsewise the list of updated chunks is compared to the list of currently loaded chunks. For each loaded chunk the corresponding update chunk is downloaded. All module updates as stored in the runtime as update. The runtime switches into the `ready` state, meaning an update has been downloaded and is ready to be applied.
4444

4545
For each new chunk request in the ready state the update chunk is also downloaded.
4646

47-
The `apply` method flags all updated modules as invalid. For each invalid module there need to be a update handler in the module or update handlers in every parent. Else the invalid buddles up and mark all parents as invalid too. This process continues until no more "bubble up" occurs. If it bubbles up from an entry point the process fails.
47+
The `apply` method flags all updated modules as invalid. For each invalid module there need to be a update handler in the module or update handlers in every parent. Else the invalid buddles up and marks all parents as invalid too. This process continues until no more "bubble up" occurs. If it bubbles up from an entry point the process fails.
4848

4949
Now all invalid modules are disposed (dispose handler) and unloaded. Then the current hash is updated and all "accept" handlers are called. The runtime switches back to the `idle` state and everything continues as normal.
5050

5151
## What can I do with it?
5252

53-
You can use it in development as LiveReload replacement. webpack-dev-server supports a hot mode which tries to update with HMR before trying to reload the whole page. See how to implement [HMR with React](/guides/hmr-react) for example.
53+
You can use it in development as a LiveReload replacement. webpack-dev-server supports a hot mode which tries to update with HMR before trying to reload the whole page. See how to implement [HMR with React](/guides/hmr-react) for example.
5454

5555
Some loaders already generate modules that are hot-updateable. i.e. the `style-loader` can exchange the stylesheet. You don't need to do anything special.
5656

0 commit comments

Comments
 (0)