Skip to content

docs(cn): translate src/content/plugins/hot-module-replacement-plugin.md #802

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

Merged
merged 2 commits into from
Jul 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/content/plugins/hot-module-replacement-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ related:
url: /api/hot-module-replacement
---

Enables [Hot Module Replacement](/concepts/hot-module-replacement), otherwise known as HMR.
[Hot Module Replacement](/concepts/hot-module-replacement),除此之外还被称为 HMR

W> HMR should __never__ be used in production.
W> HMR **绝对不能**被用在生产环境。


## Basic Usage
## 基本使用

Enabling HMR is easy and in most cases no options are necessary.
启用 HMR 很容易,且在大多数情况下不需要任何配置。

``` javascript
new webpack.HotModuleReplacementPlugin({
Expand All @@ -27,11 +27,11 @@ new webpack.HotModuleReplacementPlugin({
```


## Options
## 配置选项

The following options are accepted:
可接收以下配置选项:

- `multiStep` (boolean): If `true`, the plugin will build in two steps -- first compiling the hot update chunks, and then the remaining normal assets.
- `fullBuildTimeout` (number): The delay between the two steps when `multiStep` is enabled.
- `multiStep` (boolean): `true`,插件会分两步构建 —— 首先编译热更新 chunk,然后保留普通资源(normal assets)。
- `fullBuildTimeout` (number): 用于当 `multiStep` 启用时,定义两个步骤之间的延迟时间。

W> These options are experimental and may be deprecated. As mentioned above, they are typically not necessary and including a `new webpack.HotModuleReplacementPlugin()` is enough.
W> 这些选项是实验性的并且可能会被弃用。就像上面说的,它们并非必须,正常情况下只需要 `new webpack.HotModuleReplacementPlugin()` 就足够了。