Skip to content

Commit d8d7ccb

Browse files
committed
docs(cn): resolve conflicts
1 parent 44aba03 commit d8d7ccb

1 file changed

Lines changed: 14 additions & 34 deletions

File tree

docs/configuration-options/index.md

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,31 +1440,19 @@ export default {
14401440
| --: | :-- |
14411441
| 类型: | `{ [chunkAlias: string]: string[] } \| ((id: string, {getModuleInfo, getModuleIds}) => string \| void)` |
14421442

1443-
<<<<<<< HEAD
1444-
该选项允许你创建自定义的公共 chunk。当值为对象形式时,每个属性代表一个 chunk,其中包含列出的模块及其所有依赖,除非他们已经在其他 chunk 中,否则将会是模块图(module graph)的一部分。chunk 的名称由对象属性的键决定。
1443+
该选项允许你创建自定义的公共块。当值为对象形式时,可用于更简单、更安全的手动分块,为函数形式时,可以实现更强大且可控的行为。
14451444

1446-
请注意,列出的模块本身不一定是模块图的一部分,该特性对于使用 `@rollup/plugin-node-resolve` 包并从中使用深度引用(deep imports)是非常有用的。例如:
1447-
=======
1448-
Allows the creation of custom shared common chunks. The object form can be used for an easier and safer manual chunking, and the function form can be used for a more powerful and controlled behavior.
1449-
1450-
When using the object form, each property represents a chunk that contains the listed modules and all their dependencies if they are part of the module graph unless they are already in another manual chunk. The name of the chunk will be determined by the property key. Note that it is not necessary for the listed modules themselves to be part of the module graph, which is useful if you are working with `@rollup/plugin-node-resolve` and use deep imports from packages. For instance
1451-
>>>>>>> 2029f639f983289619538c60bc14eebc638c6926
1445+
对象形式时,每个属性代表一个包含所列出的模块及其所有依赖项的块(若这些依赖项属于模块图且未被其他手动块包含)。块的名称由属性键决定。需要注意的是,列出的模块本身不一定是模块图的一部分,该特性对于使用 `@rollup/plugin-node-resolve` 包并使用深度引用(deep imports)时非常有用的。例如:
14521446

14531447
```javascript
14541448
manualChunks: {
14551449
lodash: ['lodash'];
14561450
}
14571451
```
14581452

1459-
<<<<<<< HEAD
1460-
上述例子中,即使你只是使用 `import get from 'lodash/get'` 形式引入,Rollup 也会将 lodash 的所有模块放到一个自定义 chunk 中。
1453+
上述例子中,即使你只是使用 `import get from 'lodash/get'` 形式引入,Rollup 也会将 lodash 的所有模块合并到一个自定义 chunk 中。
14611454

14621455
当该选项值为函数形式时,每个被解析的模块都会经过该函数处理。如果函数返回字符串,那么该模块及其所有依赖将被添加到以返回字符串命名的自定义 chunk 中。例如,以下例子会创建一个命名为 `vendor` 的 chunk,它包含所有在 `node_modules` 中的依赖:
1463-
=======
1464-
will merge all lodash modules into a manual chunk even if you are only using imports of the form `import get from 'lodash/get'`.
1465-
1466-
When using the function form, each resolved module id will be passed to the function. If a string is returned, the module and all its dependencies will be added to the manual chunk with the given name. For instance this will create a `vendor` chunk containing all dependencies inside `node_modules`:
1467-
>>>>>>> 2029f639f983289619538c60bc14eebc638c6926
14681456

14691457
```javascript twoslash
14701458
// ---cut-start---
@@ -1479,13 +1467,9 @@ function manualChunks(id) {
14791467
}
14801468
```
14811469

1482-
<<<<<<< HEAD
1483-
请注意,如果自定义 chunk 在使用相应模块之前触发了副作用,那么它可能改变整个应用的行为。
1484-
=======
1485-
By default, the function form will also merge dependencies of the returned ids into the manualChunk. If you need stricter behavior, you can use [output.onlyExplicitManualChunks](#output-onlyexplicitmanualchunks), which will be the default in Rollup 5.
1470+
默认情况下,函数形式也会将返回ID的依赖项合并到 `manualChunk` 中。如果需要更严格的行为,可以使用 [`output.onlyExplicitManualChunks`](#output-onlyexplicitmanualchunks),该选项将在 Rollup 5 中成为默认设置。
14861471

1487-
Be aware that manual chunks can change the behaviour of the application if side effects are triggered before the corresponding modules are actually used.
1488-
>>>>>>> 2029f639f983289619538c60bc14eebc638c6926
1472+
请注意,如果自定义 chunk 在使用相应模块之前触发了副作用,那么它可能改变整个应用的行为。
14891473

14901474
`manualChunks` 值为函数形式时,它的第二个参数是一个对象,包含 `getModuleInfo` 函数和 `getModuleIds` 函数,其工作方式与插件上下文中的 [`this.getModuleInfo`](../plugin-development/index.md#this-getmoduleinfo)[`this.getModuleIds`](../plugin-development/index.md#this-getmoduleids) 相同。
14911475

@@ -3123,23 +3107,20 @@ _使用 [`output.externalImportAttributes`](#output-externalimportattributes)
31233107
| CLI: | `--externalImportAssertions`/`--no-externalImportAssertions` |
31243108
| 默认: | `true` |
31253109

3126-
<<<<<<< HEAD
31273110
是否在输出中为外部导入添加导入断言,如果输出格式为 `es`。默认情况下,断言来自输入文件,但是插件可以稍后添加或删除断言。例如,`import "foo" assert {type: "json"}` 将导致相同的导入出现在输出中,除非将该选项设置为 `false`。请注意,模块的所有导入都需要具有一致的断言,否则将发出警告。
3128-
=======
3129-
Whether to add import assertions to external imports in the output if the output format is `es`. By default, assertions are taken from the input files, but plugins can add or remove assertions later. E.g. `import "foo" assert {type: "json"}` will cause the same import to appear in the output unless the option is set to `false`. Note that all imports of a module need to have consistent assertions, otherwise a warning is emitted.
31303111

31313112
### output.onlyExplicitManualChunks
31323113

3133-
| | |
3134-
| ----: | :-------- |
3135-
| Type: | `boolean` |
3114+
| | |
3115+
| -----: | :-------- |
3116+
| 类型: | `boolean` |
31363117

3137-
If set to true, using the [output.manualChunks](#output-manualchunks) function form won't merge dependencies into the output chunk.
3118+
该选项如果设置为 `true`,使用 [output.manualChunks](#output-manualchunks) 的函数形式时,不会将依赖项合并到输出块中。
31383119

3139-
For instance, with
3120+
例如,以下项目结构
31403121

31413122
```js
3142-
// src/main.js (entry point)
3123+
// src/main.js (入口文件)
31433124
import './manual1';
31443125
import './manual2';
31453126

@@ -3159,7 +3140,7 @@ console.log('manual2');
31593140
console.log('dep');
31603141
```
31613142

3162-
and
3143+
并配置
31633144

31643145
<!-- prettier-ignore-start -->
31653146

@@ -3174,7 +3155,6 @@ function manualChunks(id) {
31743155
}
31753156
```
31763157

3177-
the dep.js `export const dep = 'dep';` code, won't be merged into the `manual` output chunk. This gives you full control over what code goes into which manual chunks, and if your manual chunking is very granular, this can prevent import graph inaccuracies and help reduce cache invalidation.
3158+
dep.js 中的 `export const dep = 'dep';` 代码将不会被合并到 `manual` 手动分块中。这使你能够完全控制哪些代码进入哪个手动分块。如果您的手动分块非常细粒度,这可以防止导入图的不准确,并帮助减少缓存失效。
31783159

3179-
Note: although this option is new in Rollup 4, it is marked as deprecated because it will become the new default for the function form in Rollup 5.
3180-
>>>>>>> 2029f639f983289619538c60bc14eebc638c6926
3160+
请注意,尽管此选项在 Rollup 4 中是新增的,但它已被标记为已弃用(deprecated),因为在 Rollup 5 中,函数形式将直接采用此行为作为默认设置。

0 commit comments

Comments
 (0)