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.
Please create a Rsbuild configuration file rsbuild.config.ts
in the same directory as package.json
and add the following content:
With this, the basic migration from CRA to Rsbuild is complete. 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.