-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs(cn): translate src/content/plugins/dll-plugin.md #795
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
Deploy preview for cn-webpack ready! Built with commit b24f560 |
Deploy preview for cn-webpack ready! Built with commit 38e37da |
src/content/plugins/dll-plugin.md
Outdated
- `path`: __absolute path__ to the manifest json file (output) | ||
- `entryOnly` (boolean = true): if `true`, only entry points will be exposed | ||
- `type`: type of the dll bundle | ||
- `context` (可选的): manifest 文件中请求的上下文(context)(默认值为 webpack 的上下文(context)) |
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.
- `context` (可选的): manifest 文件中请求的上下文(context)(默认值为 webpack 的上下文(context)) | |
- `context`(可选):manifest 文件中请求的 context(默认值为 webpack 的 context) |
src/content/plugins/dll-plugin.md
Outdated
- `entryOnly` (boolean = true): if `true`, only entry points will be exposed | ||
- `type`: type of the dll bundle | ||
- `context` (可选的): manifest 文件中请求的上下文(context)(默认值为 webpack 的上下文(context)) | ||
- `format` (boolean = false): 如果为 `true`,则 manifest json 文件 (输出文件) 将被格式化。 |
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.
- `format` (boolean = false): 如果为 `true`,则 manifest json 文件 (输出文件) 将被格式化。 | |
- `format` (boolean = false):如果为 `true`,则 manifest.json 文件 (输出文件) 将被格式化。 |
src/content/plugins/dll-plugin.md
Outdated
- `context` (可选的): manifest 文件中请求的上下文(context)(默认值为 webpack 的上下文(context)) | ||
- `format` (boolean = false): 如果为 `true`,则 manifest json 文件 (输出文件) 将被格式化。 | ||
- `name`: 暴露出的 DLL 的函数名 ([TemplatePaths](https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js): `[hash]` & `[name]` ) | ||
- `path`: manifest json 文件的 __绝对路径__ (输出文件) |
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.
- `path`: manifest json 文件的 __绝对路径__ (输出文件) | |
- `path`:manifest.json 文件的__绝对路径__(输出文件) |
src/content/plugins/dll-plugin.md
Outdated
- `type`: type of the dll bundle | ||
- `context` (可选的): manifest 文件中请求的上下文(context)(默认值为 webpack 的上下文(context)) | ||
- `format` (boolean = false): 如果为 `true`,则 manifest json 文件 (输出文件) 将被格式化。 | ||
- `name`: 暴露出的 DLL 的函数名 ([TemplatePaths](https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js): `[hash]` & `[name]` ) |
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.
- `name`: 暴露出的 DLL 的函数名 ([TemplatePaths](https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js): `[hash]` & `[name]` ) | |
- `name`:暴露出的 DLL 的函数名([TemplatePaths](https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js):`[hash]` & `[name]`) |
src/content/plugins/dll-plugin.md
Outdated
- `format` (boolean = false): 如果为 `true`,则 manifest json 文件 (输出文件) 将被格式化。 | ||
- `name`: 暴露出的 DLL 的函数名 ([TemplatePaths](https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js): `[hash]` & `[name]` ) | ||
- `path`: manifest json 文件的 __绝对路径__ (输出文件) | ||
- `entryOnly` (boolean = true): 如果为 `true`,则仅暴露入口点 |
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.
- `entryOnly` (boolean = true): 如果为 `true`,则仅暴露入口点 | |
- `entryOnly` (boolean = true):如果为 `true`,则仅暴露入口 |
src/content/plugins/dll-plugin.md
Outdated
|
||
```javascript | ||
new webpack.DllPlugin(options); | ||
``` | ||
|
||
W> We recommend using DllPlugin only with `entryOnly: true`, otherwise tree shaking in the DLL won't work as all the exports might be used. | ||
W> 我们建议仅将 DllPlugin 与 `entryOnly: true` 一起使用,否则 DLL 中的 tree shaking 将无法工作,因为可能会使用所有导出。 |
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.
W> 我们建议仅将 DllPlugin 与 `entryOnly: true` 一起使用,否则 DLL 中的 tree shaking 将无法工作,因为可能会使用所有导出。 | |
W> 我们建议 DllPlugin 只在 `entryOnly: true` 时使用,否则 DLL 中的 tree shaking 将无法工作,因为所有 exports 均可使用。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
Creates a `manifest.json` which is written to the given `path`. It contains mappings from require and import requests to module ids. It is used by the `DllReferencePlugin`. | ||
在给定的 `path` 路径下创建一个名为 `manifest.json` 的文件。 这个文件包含了从 require 和 import 的 request 到模块 id 的映射。 `DllReferencePlugin` 也会用到这个文件。 |
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.
在给定的 `path` 路径下创建一个名为 `manifest.json` 的文件。 这个文件包含了从 require 和 import 的 request 到模块 id 的映射。 `DllReferencePlugin` 也会用到这个文件。 | |
在给定的 `path` 路径下创建一个 `manifest.json` 文件。这个文件包含了从 require 和 import 中 request 到模块 id 的映射。`DllReferencePlugin` 也会用到这个文件。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
Combine this plugin with [`output.library`](/configuration/output/#outputlibrary) option to expose (aka, put into the global scope) the dll function. | ||
这个插件与 [`output.library`](/configuration/output/#outputlibrary) 的选项相结合可以暴露出 (也称为放入全局作用域) dll 函数。 |
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.
这个插件与 [`output.library`](/configuration/output/#outputlibrary) 的选项相结合可以暴露出 (也称为放入全局作用域) dll 函数。 | |
此插件与 [`output.library`](/configuration/output/#outputlibrary) 的选项相结合可以暴露出(也称为放入全局作用域)dll 函数。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
|
||
## `DllReferencePlugin` | ||
|
||
This plugin is used in the primary webpack config, it references the dll-only-bundle(s) to require pre-built dependencies. | ||
这个插件是在 webpack 主配置文件中设置的, 这个插件把只有 dll 的 bundle(们)(dll-only-bundle(s))引用到需要的预编译的依赖。 |
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.
这个插件是在 webpack 主配置文件中设置的, 这个插件把只有 dll 的 bundle(们)(dll-only-bundle(s))引用到需要的预编译的依赖。 | |
此插件配置在 webpack 的主配置文件中,此插件会把 dll-only-bundles 引用到需要的预编译的依赖中。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
_Two separate example folders. Demonstrates scope and context._ | ||
_两个单独的用例,用来分别演示作用域(scope)和上下文(context)。_ |
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.
_两个单独的用例,用来分别演示作用域(scope)和上下文(context)。_ | |
_两个单独的用例,用来分别演示作用域(scope)和上下文(context)。_ |
src/content/plugins/dll-plugin.md
Outdated
|
||
|
||
## References | ||
## 引用参考(References) |
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.
## 引用参考(References) | |
## 参考 |
src/content/plugins/dll-plugin.md
Outdated
@@ -105,16 +105,16 @@ new webpack.DllReferencePlugin({ | |||
``` | |||
|
|||
|
|||
## Examples | |||
## 示例(Examples) |
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.
## 示例(Examples) | |
## 示例 |
src/content/plugins/dll-plugin.md
Outdated
|
||
W> `DllReferencePlugin` and `DllPlugin` are used in _separate_ webpack configs. | ||
W> `DllReferencePlugin` 和 `DllPlugin` 都是在 _单独的_ webpack 设置中使用的。 |
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.
W> `DllReferencePlugin` 和 `DllPlugin` 都是在 _单独的_ webpack 设置中使用的。 | |
W> `DllReferencePlugin` 和 `DllPlugin` 都是在_单独的_ webpack 配置中使用的。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
Because this happens after resolving every file in the dll bundle, the same paths must be available for the consumer of the dll bundle. i.e. if the dll contains `lodash` and the file `abc`, `require('lodash')` and `require('./abc')` will be used from the dll, rather than building them into the main bundle. | ||
由于这是在解析了 dll 中每个文件之后才发生的,相同的路径必须能够确保这个 dll bundle 的使用者(不一定是人,可指某些代码)有权限访问。 举例来说, 假如一个 dll bundle 中含有 `loadash`库以及文件 `abc`, 那么 `require("lodash")` 和 `require("./abc")` 都不会被编译进主要的 bundle 文件,而是会被 dll 所使用。 |
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.
由于这是在解析了 dll 中每个文件之后才发生的,相同的路径必须能够确保这个 dll bundle 的使用者(不一定是人,可指某些代码)有权限访问。 举例来说, 假如一个 dll bundle 中含有 `loadash`库以及文件 `abc`, 那么 `require("lodash")` 和 `require("./abc")` 都不会被编译进主要的 bundle 文件,而是会被 dll 所使用。 | |
由于这是在解析了 dll 中每个文件之后才触发的,因此相同的路径必须能够确保这个 dll bundle 的使用者(不一定是人,可指某些代码)有权限访问。举例来说,假如一个 dll bundle 中含有 `loadash` 库以及文件 `abc`,那么 `require("lodash")` 和 `require("./abc")` 都不会被编译进主 bundle 文件中,而是会被 dll 所使用。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
#### Mapped Mode | ||
|
||
The content of the dll is mapped to the current directory. If a required file matches a file in the dll (after resolving), then the file from the dll is used instead. | ||
dll 中的内容被映射到了当前目录下。如果一个被 `require` 的文件符合 dll 中的某个文件(解析之后),那么这个dll中的这个文件就会被使用。 |
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.
dll 中的内容被映射到了当前目录下。如果一个被 `require` 的文件符合 dll 中的某个文件(解析之后),那么这个dll中的这个文件就会被使用。 | |
dll 中的内容会被映射到当前目录下。如果被 `require` 的文件与 dll 中的某个文件匹配(解析之后),那么这个 dll 中的文件就会被使用。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
#### Scoped Mode | ||
|
||
The content of the dll is accessible under a module prefix. i.e. with `scope = 'xyz'` a file `abc` in the dll can be access via `require('xyz/abc')`. | ||
dll 中的内容可以在模块前缀下被引用,举例来说,令 `scope = 'xyz'` 的话,这个 dll 中的名为 `abc` 的文件可以通过 `require('xyz/abc')` 来获取。 |
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.
dll 中的内容可以在模块前缀下被引用,举例来说,令 `scope = 'xyz'` 的话,这个 dll 中的名为 `abc` 的文件可以通过 `require('xyz/abc')` 来获取。 | |
dll 中的内容可以使用模块前缀的方式引用,举例来说,设置 `scope = 'xyz'`,这个 dll 中的名为 `abc` 的文件可以通过 `require('xyz/abc')` 来获取。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
This plugin can be used in two different modes, _scoped_ and _mapped_. | ||
这个插件支持两种模式,分别是作用域(_scoped_)和映射(_mapped_)。 |
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.
这个插件支持两种模式,分别是作用域(_scoped_)和映射(_mapped_)。 | |
这个插件支持两种模式,分别是作用域(_scoped_)和映射(_mapped_)。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
W> Keep the `name` consistent with [`output.library`](/configuration/output/#outputlibrary). | ||
W> 与 [`output.library`](/configuration/output/#outputlibrary) 保持 `name` 的一致性。 |
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.
W> 与 [`output.library`](/configuration/output/#outputlibrary) 保持 `name` 的一致性。 | |
W> 保持 `name` 与 [`output.library`](/configuration/output/#outputlibrary) 一致。 |
src/content/plugins/dll-plugin.md
Outdated
|
||
```javascript | ||
new webpack.DllReferencePlugin(options); | ||
``` | ||
|
||
References a dll manifest file to map dependency names to module ids, then requires them as needed using the internal `__webpack_require__` function. | ||
通过引用 dll 的 manifest 文件来把依赖的名称映射到模块的 id 上,之后再在需要的时候通过内置的 `__webpack_require__` 函数来 `require` 他们 |
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.
通过引用 dll 的 manifest 文件来把依赖的名称映射到模块的 id 上,之后再在需要的时候通过内置的 `__webpack_require__` 函数来 `require` 他们 | |
通过引用 dll 的 manifest 文件来把依赖的名称映射到模块的 id 上,之后再在需要的时候通过内置的 `__webpack_require__` 函数来 `require` 对应的模块 |
src/content/plugins/dll-plugin.md
Outdated
- `name` (optional): an identifier where the dll is exposed (defaults to `manifest.name`) (see also [`externals`](/configuration/externals/)) | ||
- `scope` (optional): prefix which is used for accessing the content of the dll | ||
- `sourceType` (optional): how the dll is exposed ([libraryTarget](/configuration/output/#outputlibrarytarget)) | ||
- `context`: (__绝对路径__) manifest (或者是内容属性)中请求的上下文 |
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.
- `context`: (__绝对路径__) manifest (或者是内容属性)中请求的上下文 | |
- `context`:(__绝对路径__) manifest (或者是内容属性)中的请求上下文 |
src/content/plugins/dll-plugin.md
Outdated
- `scope` (optional): prefix which is used for accessing the content of the dll | ||
- `sourceType` (optional): how the dll is exposed ([libraryTarget](/configuration/output/#outputlibrarytarget)) | ||
- `context`: (__绝对路径__) manifest (或者是内容属性)中请求的上下文 | ||
- `extensions`: 用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 |
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.
- `extensions`: 用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 | |
- `extensions`:用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 |
src/content/plugins/dll-plugin.md
Outdated
- `sourceType` (optional): how the dll is exposed ([libraryTarget](/configuration/output/#outputlibrarytarget)) | ||
- `context`: (__绝对路径__) manifest (或者是内容属性)中请求的上下文 | ||
- `extensions`: 用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 | ||
- `manifest` : 包含 `content` 和 `name` 的对象,或者在编译时(compilation)的一个用于加载的 JSON manifest 绝对路径 |
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.
- `manifest` : 包含 `content` 和 `name` 的对象,或者在编译时(compilation)的一个用于加载的 JSON manifest 绝对路径 | |
- `manifest`:包含 `content` 和 `name` 的对象,或者是一个字符串 —— 编译时用于加载 JSON manifest 的绝对路径 |
src/content/plugins/dll-plugin.md
Outdated
- `context`: (__绝对路径__) manifest (或者是内容属性)中请求的上下文 | ||
- `extensions`: 用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 | ||
- `manifest` : 包含 `content` 和 `name` 的对象,或者在编译时(compilation)的一个用于加载的 JSON manifest 绝对路径 | ||
- `content` (可选的): 请求到模块 id 的映射 (默认值为 `manifest.content`) |
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.
- `content` (可选的): 请求到模块 id 的映射 (默认值为 `manifest.content`) | |
- `content`(可选):请求到模块 id 的映射(默认值为 `manifest.content`) |
src/content/plugins/dll-plugin.md
Outdated
- `extensions`: 用于解析 dll bundle 中模块的扩展名 (仅在使用 'scope' 时使用)。 | ||
- `manifest` : 包含 `content` 和 `name` 的对象,或者在编译时(compilation)的一个用于加载的 JSON manifest 绝对路径 | ||
- `content` (可选的): 请求到模块 id 的映射 (默认值为 `manifest.content`) | ||
- `name` (可选的): dll 暴露的地方的名称 (默认值为 `manifest.name`) (可参考[`externals`](/configuration/externals/)) |
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.
- `name` (可选的): dll 暴露的地方的名称 (默认值为 `manifest.name`) (可参考[`externals`](/configuration/externals/)) | |
- `name`(可选):dll 暴露地方的名称(默认值为 `manifest.name`)(可参考[`externals`](/configuration/externals/)) |
src/content/plugins/dll-plugin.md
Outdated
- `manifest` : 包含 `content` 和 `name` 的对象,或者在编译时(compilation)的一个用于加载的 JSON manifest 绝对路径 | ||
- `content` (可选的): 请求到模块 id 的映射 (默认值为 `manifest.content`) | ||
- `name` (可选的): dll 暴露的地方的名称 (默认值为 `manifest.name`) (可参考[`externals`](/configuration/externals/)) | ||
- `scope` (可选的): dll 中内容的前缀 |
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.
- `scope` (可选的): dll 中内容的前缀 | |
- `scope` (可选):dll 中内容的前缀 |
src/content/plugins/dll-plugin.md
Outdated
- `content` (可选的): 请求到模块 id 的映射 (默认值为 `manifest.content`) | ||
- `name` (可选的): dll 暴露的地方的名称 (默认值为 `manifest.name`) (可参考[`externals`](/configuration/externals/)) | ||
- `scope` (可选的): dll 中内容的前缀 | ||
- `sourceType` (可选的): dll 是如何暴露的 ([libraryTarget](/configuration/output/#outputlibrarytarget)) |
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.
- `sourceType` (可选的): dll 是如何暴露的 ([libraryTarget](/configuration/output/#outputlibrarytarget)) | |
- `sourceType`(可选):dll 是如何暴露的 ([libraryTarget](/configuration/output/#outputlibrarytarget)) |
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.
问题蛮多的,修改下吧
读着并不顺畅 |
按照建议,做了调整 @QC-L |
1 similar comment
按照建议,做了调整 @QC-L |
describe your changes...