Skip to content

Commit 494f854

Browse files
authored
docs(rolldown): add manualChunks to advancedChunks migration guide (#20161)
1 parent 71c4d53 commit 494f854

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/guide/rolldown.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,42 @@ Rolldown throws an error when unknown or invalid options are passed. Because som
9999
100100
If you don't pass the option in yourself, this must be fixed by the utilized framework. You can suppress this error in the meantime by setting the `ROLLDOWN_OPTIONS_VALIDATION=loose` environment variable.
101101

102+
### API Differences
103+
104+
#### `manualChunks` to `advancedChunks`
105+
106+
Rolldown does not support the `manualChunks` option that was available in Rollup. Instead, it offers a more fine-grained setting via the [`advancedChunks` option](https://rolldown.rs/guide/in-depth/advanced-chunks#advanced-chunks), which is more similar to webpack's `splitChunk`:
107+
108+
```js
109+
// Old configuration (Rollup)
110+
export default {
111+
build: {
112+
rollupOptions: {
113+
output: {
114+
manualChunks(id) {
115+
if (/\/react(?:-dom)?/.test(id)) {
116+
return 'vendor'
117+
}
118+
}
119+
}
120+
}
121+
}
122+
}
123+
124+
// New configuration (Rolldown)
125+
export default {
126+
build: {
127+
rollupOptions: {
128+
output: {
129+
advancedChunks: {
130+
groups: [{ name: 'vendor', test: /\/react(?:-dom)?// }]
131+
}
132+
}
133+
}
134+
}
135+
}
136+
```
137+
102138
## Performance
103139

104140
`rolldown-vite` is focused on ensuring compatibility with the existing ecosystem, so defaults are geared towards a smooth transition. You can get further performance gains by switching over to faster Rust-based internal plugins and other customizations.

0 commit comments

Comments
 (0)