Skip to content

updated /content/plugins/module-concatenation-plugin.md(#377) #379

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 16 commits into from
Oct 18, 2017

Conversation

TyreeZhao
Copy link

@TyreeZhao TyreeZhao commented Oct 11, 2017

describe your changes...

  • Read and sign the CLA. PRs that haven't signed it won't be accepted.
  • Make sure your PR complies with the writer's guide.
  • Review the diff carefully as sometimes this can reveal issues.
  • Remove these instructions from your PR as they are for your eyes only.

@dear-lizhihua
Copy link

dear-lizhihua commented Oct 11, 2017

有冲突,你得合并下上游的更新

@TyreeZhao
Copy link
Author

@dear-lizhihua 好了

捆绑失败优化 => 捆绑失败的优化

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:
像文章中解释的, webpack 试图达到分批的作用域提升(scope hoisting)。它会将一些模型捆绑到一个作用域内,但并不是任何情况下都会这么做。如果 webpack 不能捆绑模型,将会有两个选择 `Prevent` 和 `Root`,`Prevent` 意思是模型必须在自己的作用域内。 `Root` 意思是一个新的模型组将被创建。以下情况决定了输出选择。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

模型 => 模块

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits: 捆绑=> 绑定

@@ -36,9 +36,9 @@ In Multiple Chunks | Prevent
`export * from "cjs-module"` | Prevent


### Module Grouping Algorithm
### 模型组算法[Module Grouping Algorithm]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

模块分组算法。

模型 => 模块
捆绑=> 绑定
@TyreeZhao
Copy link
Author

@aladdin-add fixed


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:
像文章中解释的, webpack 试图达到分批的作用域提升(scope hoisting)。它会将一些模块绑定到一个作用域内,但并不是任何情况下都会这么做。如果 webpack 不能绑定模块,将会有两个选择 `Prevent` 和 `Root`,`Prevent` 意思是模块必须在自己的作用域内。 `Root` 意思是一个新的模块组将被创建。以下情况决定了输出选择。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这篇里,merge 是翻译成绑定吗?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreventRoot 不需要加 ``,尽量与原文标点保持一致。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

意思是一个新的模块组将被创建 -> 意味着将创建一个新的模块组
以下情况决定了输出选择。 -> 以下条件决定了输出结果:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,个人感觉 “捆绑” 比 “合并” 意思更合适


The following pseudo JavaScript explains the algorithm:
下面的 JS 解释了算法:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS -> JavaScript,与原文保持一致

下面的 JS 解释了算法 -> 以下 JavaScript 伪代码解释了算法

@@ -80,10 +80,9 @@ function tryToAdd(group, module) {
}
```

### 优化绑定失败的调试[Debugging Optimization Bailouts]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里行数不对应,少了一个空行

### Debugging Optimization Bailouts

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:
当我们使用 webpack CLI 时,参数 `--display-optimization-bailout` 将显示绑定失败的原因。在 webpack 配置里,加上下面的 `stats` 对象:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上下面的 stats 对象: -> 只需将以下内容添加到 stats 对象中:

@aladdin-add aladdin-add merged commit 08f324f into docschina:cn Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants