Skip to content

Commit e58a803

Browse files
authored
docs: improve 0.x migration guide (#3252)
1 parent 13a70c0 commit e58a803

File tree

2 files changed

+98
-14
lines changed

2 files changed

+98
-14
lines changed

website/docs/en/guide/migration/rsbuild-0-x.mdx

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default {
9494

9595
## source.alias
9696

97-
Removed `target` param for `source.alias` function, use `environment` config instead.
97+
Removed `target` param for `source.alias` function, use [environments](/config/environments) config instead.
9898

9999
- before:
100100

@@ -146,7 +146,7 @@ export default {
146146

147147
## source.entry
148148

149-
Removed function usage of `source.entry`, use `environments` config instead.
149+
Removed function usage of `source.entry`, use [environments](/config/environments) config instead.
150150

151151
- before:
152152

@@ -203,7 +203,7 @@ export default {
203203

204204
## output.overrideBrowserslist
205205

206-
`output.overrideBrowserslist` no longer supports `Record<RsbuildTarget, string[]` type, use `environments` config instead.
206+
`output.overrideBrowserslist` no longer supports `Record<RsbuildTarget, string[]` type, use [environments](/config/environments) config instead.
207207

208208
- before:
209209

@@ -239,7 +239,7 @@ export default defineConfig({
239239

240240
## output.emitAssets
241241

242-
`output.emitAssets` changed to boolean type, use `environments` config instead.
242+
`output.emitAssets` changed to boolean type, use [environments](/config/environments) config instead.
243243

244244
- before:
245245

@@ -274,7 +274,7 @@ export default {
274274

275275
## output.distPath.server
276276

277-
Removed `output.distPath.server`, use the `environments` config instead.
277+
Removed `output.distPath.server`, use the [environments](/config/environments) config instead.
278278

279279
```js
280280
export default {
@@ -314,9 +314,23 @@ export default {
314314

315315
And we plan to use some faster Rust-based HTML minimizer in the future.
316316

317+
## output.charset
318+
319+
The default value of [output.charset](/config/output/charset) has been changed from `ascii` to `utf8`.
320+
321+
If you need to use `ascii`, you can add the following config:
322+
323+
```ts
324+
export default {
325+
output: {
326+
charset: 'ascii',
327+
},
328+
};
329+
```
330+
317331
## dev.startUrl
318332

319-
`dev.startUrl` has been renamed to `server.open`:
333+
`dev.startUrl` has been renamed to [server.open](/config/server/open):
320334

321335
```diff
322336
export default {
@@ -343,6 +357,34 @@ export default {
343357
};
344358
```
345359

360+
## html.appIcon
361+
362+
Previously, [html.appIcon](/config/html/app-icon) did not support for web app manifests, meaning it was only available on iOS.
363+
364+
Now `html.appIcon` supports generating web app manifests, and the type of `html.appIcon` has been changed.
365+
366+
- before:
367+
368+
```js
369+
export default {
370+
html: {
371+
appIcon: './src/icon.png',
372+
},
373+
};
374+
```
375+
376+
- after:
377+
378+
```js
379+
export default {
380+
html: {
381+
appIcon: {
382+
icons: [{ src: './src/icon.png', size: 180 }],
383+
},
384+
},
385+
};
386+
```
387+
346388
## Others
347389

348390
Rsbuild 1.0 has made some adjustments and optimizations to plugins API and dev server API.

website/docs/zh/guide/migration/rsbuild-0-x.mdx

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export default defineConfig({
5656
## [重要] output.targets
5757

5858
:::tip
59-
Rsbuild v1 移除了 `output.targets` 选项和 `source.alias` / `source.entry` 等配置的 target 参数,改为通过 `environments` 配置以提供更灵活的多环境配置能力。
59+
Rsbuild v1 移除了 `output.targets` 选项,以及 `source.alias` / `source.entry` 等配置的 target 参数,改为通过 `environments` 配置以提供更灵活的多环境配置能力。
6060

6161
对比原有选项,`environments` 覆盖范围更广,可对更多配置项进行多环境差异化配置。详情可参考[多环境构建](/guide/advanced/environments)
6262
:::
6363

64-
移除 `output.targets` 参数,改用 [output.target](/config/output/target)[environments](/config/environments) 配置。
64+
移除 `output.targets` 配置,改用 [output.target](/config/output/target)[environments](/config/environments) 配置。
6565

6666
- before:
6767

@@ -94,7 +94,7 @@ export default {
9494

9595
## source.alias
9696

97-
移除 `source.alias` 函数的 `target` 参数,改用 `environments` 配置。
97+
移除 `source.alias` 函数的 `target` 参数,改用 [environments](/config/environments) 配置。
9898

9999
- before:
100100

@@ -146,7 +146,7 @@ export default {
146146

147147
## source.entry
148148

149-
移除了 `source.entry` 函数用法,改为使用 `environments` 配置。
149+
移除了 `source.entry` 函数用法,改为使用 [environments](/config/environments) 配置。
150150

151151
- before:
152152

@@ -203,7 +203,7 @@ export default {
203203

204204
## output.overrideBrowserslist
205205

206-
`output.overrideBrowserslist` 不再支持 `Record<RsbuildTarget, string[]>` 类型,使用 `environments` 配置代替。
206+
`output.overrideBrowserslist` 不再支持 `Record<RsbuildTarget, string[]>` 类型,使用 [environments](/config/environments) 配置代替。
207207

208208
- before:
209209

@@ -239,7 +239,7 @@ export default defineConfig({
239239

240240
## output.emitAssets
241241

242-
`output.emitAssets` 调整为 boolean 类型,使用 `environments` 配置代替。
242+
`output.emitAssets` 调整为 boolean 类型,使用 [environments](/config/environments) 配置代替。
243243

244244
- before:
245245

@@ -274,7 +274,7 @@ export default {
274274

275275
## output.distPath.server
276276

277-
移除 `output.distPath.server`,使用 `environments` 配置代替。
277+
移除 `output.distPath.server`,使用 [environments](/config/environments) 配置代替。
278278

279279
```js
280280
export default {
@@ -314,9 +314,23 @@ export default {
314314

315315
我们计划在未来使用一些性能更好的基于 Rust 的 HTML 压缩器。
316316

317+
## output.charset
318+
319+
[output.charset](/config/output/charset) 的默认值由 `ascii` 调整为 `utf8`
320+
321+
如果你需要使用 `ascii`,可以添加配置:
322+
323+
```ts
324+
export default {
325+
output: {
326+
charset: 'ascii',
327+
},
328+
};
329+
```
330+
317331
## dev.startUrl
318332

319-
`dev.startUrl` 被重命名为 `server.open`
333+
`dev.startUrl` 被重命名为 [server.open](/config/server/open)
320334

321335
```diff
322336
export default {
@@ -343,6 +357,34 @@ export default {
343357
};
344358
```
345359

360+
## html.appIcon
361+
362+
之前,[html.appIcon](/config/html/app-icon) 不支持 web app manifests,这意味着它仅适用于 iOS。
363+
364+
现在 `html.appIcon` 支持生成 web app manifests,并且 `html.appIcon` 的类型有变更。
365+
366+
- before:
367+
368+
```js
369+
export default {
370+
html: {
371+
appIcon: './src/icon.png',
372+
},
373+
};
374+
```
375+
376+
- after:
377+
378+
```js
379+
export default {
380+
html: {
381+
appIcon: {
382+
icons: [{ src: './src/icon.png', size: 180 }],
383+
},
384+
},
385+
};
386+
```
387+
346388
## 其他
347389

348390
Rsbuild 1.0 对插件、dev server 等 API 进行了部分调整和优化。

0 commit comments

Comments
 (0)