This chapter introduces how to migrate a Create React App (CRA) project to Rsbuild.
First, you need to replace the npm dependencies of CRA with Rsbuild's dependencies.
Remove CRA dependencies:
Install Rsbuild dependencies:
Next, you need to update the npm scripts in package.json to Rsbuild's CLI commands.
Rsbuild does not integrate testing frameworks, so it does not provide a command to replace react-scripts test
. You can directly use testing frameworks such as Jest or Vitest.
Create a Rsbuild configuration file rsbuild.config.ts
in the same directory as package.json and add the following content:
This completes the basic migration from CRA to Rsbuild. You can now run the npm run start
command to try starting the development server.
If you are using the "SVG to React Component" feature of CRA (i.e., SVGR), you also need to install the SVGR plugin for Rsbuild.
For example, if you are using the following usage:
Please refer to the SVGR plugin documentation to learn how to use SVGR in Rsbuild.
The current document only covers part of the migration process. If you find suitable content to add, feel free to contribute to the documentation via pull request 🤝.
The documentation for rsbuild can be found in the rsbuild/packages/document directory.