You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
1468
1456
1469
1457
```javascript twoslash
1470
1458
// ---cut-start---
@@ -1479,13 +1467,9 @@ function manualChunks(id) {
1479
1467
}
1480
1468
```
1481
1469
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.
Be aware that manual chunks can change the behaviour of the application if side effects are triggered before the corresponding modules are actually used.
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.
3130
3111
3131
3112
### output.onlyExplicitManualChunks
3132
3113
3133
-
|||
3134
-
| ----: | :-------- |
3135
-
|Type:|`boolean`|
3114
+
|||
3115
+
| -----: | :-------- |
3116
+
|类型:|`boolean`|
3136
3117
3137
-
If set to true, using the [output.manualChunks](#output-manualchunks)function form won't merge dependencies into the output chunk.
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`手动分块中。这使你能够完全控制哪些代码进入哪个手动分块。如果您的手动分块非常细粒度,这可以防止导入图的不准确,并帮助减少缓存失效。
3178
3159
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.
0 commit comments