Skip to content

Commit 08f324f

Browse files
TyreeZhaoaladdin-add
authored andcommitted
updated /content/plugins/module-concatenation-plugin.md(#377) (#379)
* translated ModuleConcatenationPlugin * formate * added spaces. * formate * code review * optimized * updated * updated * Update module-concatenation-plugin.md * updated /content/plugins/module-concatenation-plugin.md(#377) * improved 捆绑失败优化 => 捆绑失败的优化 * scope: 范围 => 作用域 * updated 模型 => 模块 捆绑=> 绑定 * trans review * Update module-concatenation-plugin.md
1 parent 0b3b7a4 commit 08f324f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/content/plugins/module-concatenation-plugin.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ new webpack.optimize.ModuleConcatenationPlugin()
1818
> 由于实现 ECMAScript 模块语法,作用域提升(Scope Hoisting)这个特定于此语法的功能才成为可能。`webpack` 可能会根据你正在使用的模块类型和[其他的情况](https://medium.com/webpack/webpack-freelancing-log-book-week-5-7-4764be3266f5),回退到普通打包。
1919
2020

21-
## Optimization Bailouts
21+
## 绑定失败的优化[Optimization Bailouts]
2222

23-
As the article explains, webpack attempts to achieve partial scope hoisting. It will merge modules into a single scope but cannot do so in every case. If webpack cannot merge a module, the two alternatives are Prevent and Root. Prevent means the module must be in its own scope. Root means a new module group will be created. The following conditions determine the outcome:
23+
像文章中解释的, webpack 试图达到分批的作用域提升(scope hoisting)。它会将一些模块绑定到一个作用域内,但并不是任何情况下都会这么做。如果 webpack 不能绑定模块,将会有两个选择 Prevent RootPrevent 意思是模块必须在自己的作用域内。 Root 意味着将创建一个新的模块组。以下条件决定了输出结果:
2424

2525
Condition | Outcome
2626
--------------------------------------------- | --------
@@ -36,9 +36,9 @@ In Multiple Chunks | Prevent
3636
`export * from "cjs-module"` | Prevent
3737

3838

39-
### Module Grouping Algorithm
39+
### 模块分组算法[Module Grouping Algorithm]
4040

41-
The following pseudo JavaScript explains the algorithm:
41+
以下 JavaScript 伪代码解释了算法:
4242

4343
```js
4444
modules.forEach(module => {
@@ -81,9 +81,9 @@ function tryToAdd(group, module) {
8181
```
8282

8383

84-
### Debugging Optimization Bailouts
84+
### 优化绑定失败的调试[Debugging Optimization Bailouts]
8585

86-
When using the webpack CLI, the `--display-optimization-bailout` flag will display bailout reasons. When using the webpack config, just add the following to the `stats` object:
86+
当我们使用 webpack CLI 时,加上参数 `--display-optimization-bailout` 将显示绑定失败的原因。在 webpack 配置里,只需将以下内容添加到 stats 对象中:
8787

8888
```js
8989
{

0 commit comments

Comments
 (0)