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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,42 @@
1
1
# rollup changelog
2
2
3
+
## 4.52.0
4
+
5
+
_2025-09-19_
6
+
7
+
### Features
8
+
9
+
- Add option `output.onlyExplicitManualChunks` to turn off merging additional dependencies into manual chunks (#6087)
10
+
- Add support for x86_64-pc-windows-gnu platform (#6110)
11
+
12
+
### Pull Requests
13
+
14
+
-[#6087](https://github.com/rollup/rollup/pull/6087): fix: manualChunks and non manualChunks shared dependencies are merged with the first manualChunk encountered alphabetically (@maiieul)
15
+
-[#6110](https://github.com/rollup/rollup/pull/6110): Add support x86_64-pc-windows-gnu (@lsq, @lukastaegert)
16
+
-[#6118](https://github.com/rollup/rollup/pull/6118): Automatically remove REPL artefacts label from PRs (@lukastaegert)
17
+
18
+
## 4.51.0
19
+
20
+
_2025-09-19_
21
+
22
+
### Features
23
+
24
+
- Support ROLLUP_FILE_URL_OBJ placeholder to inject file URLs into the generated code (#6108)
25
+
26
+
### Bug Fixes
27
+
28
+
- Improve OpenHarmony build to work in more situations (#6115)
29
+
30
+
### Pull Requests
31
+
32
+
-[#6108](https://github.com/rollup/rollup/pull/6108): feat: support ROLLUP_FILE_URL_OBJ for URL object instead of string (@guybedford, @lukastaegert)
33
+
-[#6112](https://github.com/rollup/rollup/pull/6112): Disable Cargo cache for Android (@lukastaegert)
34
+
-[#6113](https://github.com/rollup/rollup/pull/6113): fix(deps): update rust crate swc_compiler_base to v35 (@renovate[bot])
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
1446
1452
1447
1453
```javascript
1448
-
({
1449
-
manualChunks: {
1450
-
lodash: ['lodash']
1451
-
}
1452
-
});
1454
+
manualChunks: {
1455
+
lodash: ['lodash'];
1456
+
}
1453
1457
```
1454
1458
1459
+
<<<<<<< HEAD
1455
1460
上述例子中,即使你只是使用 `import get from 'lodash/get'` 形式引入,Rollup 也会将 lodash 的所有模块放到一个自定义 chunk 中。
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
1458
1468
1459
1469
```javascript twoslash
1460
1470
// ---cut-start---
@@ -1469,7 +1479,13 @@ function manualChunks(id) {
1469
1479
}
1470
1480
```
1471
1481
1482
+
<<<<<<< HEAD
1472
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.
1486
+
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.
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
+
3131
+
### output.onlyExplicitManualChunks
3132
+
3133
+
|||
3134
+
| ----: | :-------- |
3135
+
| Type: |`boolean`|
3136
+
3137
+
If set to true, using the [output.manualChunks](#output-manualchunks) function form won't merge dependencies into the output chunk.
3138
+
3139
+
For instance, with
3140
+
3141
+
```js
3142
+
// src/main.js (entry point)
3143
+
import'./manual1';
3144
+
import'./manual2';
3145
+
3146
+
console.log('main');
3147
+
3148
+
// src/manual1.js
3149
+
import'./dep.js';
3150
+
3151
+
console.log('manual1');
3152
+
3153
+
// src/manual2.js
3154
+
import'./dep.js';
3155
+
3156
+
console.log('manual2');
3157
+
3158
+
// src/dep.js
3159
+
console.log('dep');
3160
+
```
3161
+
3162
+
and
3163
+
3164
+
<!-- prettier-ignore-start -->
3165
+
3166
+
```js twoslash
3167
+
// ---cut-start---
3168
+
/**@type{import('rollup').GetManualChunk}*/
3169
+
// ---cut-end---
3170
+
functionmanualChunks(id) {
3171
+
if (id.endsWith('manual1.js') &&id.endsWith('manual2.js')) {
3172
+
return'manual';
3173
+
}
3174
+
}
3175
+
```
3176
+
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.
3178
+
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