Commit 4d5475e 1 parent 50f01a5 commit 4d5475e Copy full SHA for 4d5475e
File tree 2 files changed +34
-0
lines changed
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,23 @@ for (const path of context.keys()) {
248
248
}
249
249
```
250
250
251
+ ## Migrating Vite plugins
252
+
253
+ Rsbuild's plugin API covers most of the Vite and Rollup plugin hooks, for example:
254
+
255
+ | Vite plugin hooks | Rsbuild plugin API |
256
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
257
+ | ` resolveId ` | [ resolve] ( /plugins/dev/core#apiresolve ) |
258
+ | ` transform ` | [ transform] ( /plugins/dev/core#apitransform ) |
259
+ | ` config ` | [ modifyRsbuildConfig] ( /plugins/dev/hooks#modifyrsbuildconfig ) |
260
+ | ` configResolved ` | [ getNormalizedConfig] ( /plugins/dev/core#apigetnormalizedconfig ) |
261
+ | ` configureServer ` | [ onBeforeStartDevServer] ( /plugins/dev/hooks#onbeforestartdevserver ) |
262
+ | ` buildStart ` | [ onBeforeBuild] ( /plugins/dev/hooks#onbeforebuild ) , [ onBeforeStartDevServer] ( /plugins/dev/hooks#onbeforestartdevserver ) |
263
+ | ` buildEnd ` | [ onAfterBuild] ( /plugins/dev/hooks#onafterbuild ) , [ onCloseDevServer] ( /plugins/dev/hooks#onclosedevserver ) |
264
+ | ` closeBundle ` | [ onCloseBuild] ( /plugins/dev/hooks#onclosebuild ) , [ onCloseDevServer] ( /plugins/dev/hooks#onclosedevserver ) |
265
+
266
+ See [ Plugin system] ( /plugins/dev/index ) for more details.
267
+
251
268
## Validating results
252
269
253
270
After completing the above steps, you have completed the basic migration from Vite to Rsbuild. You can now run the ` npm run dev ` command to try starting the dev server.
Original file line number Diff line number Diff line change @@ -248,6 +248,23 @@ for (const path of context.keys()) {
248
248
}
249
249
```
250
250
251
+ ## 迁移 Vite 插件
252
+
253
+ Rsbuild 的插件 API 覆盖了大部分的 Vite 和 Rollup 插件 hooks,例如:
254
+
255
+ | Vite 插件 hooks | Rsbuild 插件 API |
256
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
257
+ | ` resolveId ` | [ resolve] ( /plugins/dev/core#apiresolve ) |
258
+ | ` transform ` | [ transform] ( /plugins/dev/core#apitransform ) |
259
+ | ` config ` | [ modifyRsbuildConfig] ( /plugins/dev/hooks#modifyrsbuildconfig ) |
260
+ | ` configResolved ` | [ getNormalizedConfig] ( /plugins/dev/core#apigetnormalizedconfig ) |
261
+ | ` configureServer ` | [ onBeforeStartDevServer] ( /plugins/dev/hooks#onbeforestartdevserver ) |
262
+ | ` buildStart ` | [ onBeforeBuild] ( /plugins/dev/hooks#onbeforebuild ) , [ onBeforeStartDevServer] ( /plugins/dev/hooks#onbeforestartdevserver ) |
263
+ | ` buildEnd ` | [ onAfterBuild] ( /plugins/dev/hooks#onafterbuild ) , [ onCloseDevServer] ( /plugins/dev/hooks#onclosedevserver ) |
264
+ | ` closeBundle ` | [ onCloseBuild] ( /plugins/dev/hooks#onclosebuild ) , [ onCloseDevServer] ( /plugins/dev/hooks#onclosedevserver ) |
265
+
266
+ 请参考 [ 插件系统] ( /plugins/dev/index ) 文档来了解更多。
267
+
251
268
## 验证结果
252
269
253
270
完成以上步骤后,你已经完成了从 Vite 到 Rsbuild 的基本迁移,此时可以执行 ` npm run dev ` 命令来尝试启动开发服务器。
You can’t perform that action at this time.
0 commit comments