-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
有冲突,你得合并下上游的更新 |
|
||
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` 意思是一个新的模型组将被创建。以下情况决定了输出选择。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
模型 => 模块
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
模块分组算法。
@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` 意思是一个新的模块组将被创建。以下情况决定了输出选择。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这篇里,merge 是翻译成绑定吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent
和 Root
不需要加 ``,尽量与原文标点保持一致。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
意思是一个新的模块组将被创建 -> 意味着将创建一个新的模块组
以下情况决定了输出选择。 -> 以下条件决定了输出结果:
There was a problem hiding this comment.
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 解释了算法: |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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` 对象: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上下面的 stats
对象: -> 只需将以下内容添加到 stats
对象中:
describe your changes...