Quick Start

Setup Environment

Before getting started, you will need to install Node.js, and ensure that your Node.js version is not lower than 16. We recommend using the LTS version of Node.js 18.

You can check the currently used Node.js version with the following command:

node -v

If you do not have Node.js installed in your current environment, or the installed version is lower than 16, you can use nvm or fnm to install the required version.

Here is an example of how to install the Node.js 18 LTS version via nvm:

# Install the long-term support version of Node.js 18
nvm install 18 --lts

# Make the newly installed Node.js 18 as the default version
nvm alias default 18

# Switch to the newly installed Node.js 18
nvm use 18
nvm and fnm

Both nvm and fnm are Node.js version management tools. Relatively speaking, nvm is more mature and stable, while fnm is implemented using Rust, which provides better performance than nvm.

Creating an Rsbuild Project

You can use the create-rsbuild to create a new Rsbuild project. Just execute the following command:

npm
yarn
pnpm
bun
npm create rsbuild@latest

Then follow the prompts to complete the operation. You can choose from the following templates provided by create-rsbuild:

Template Description Optional Features
react React 18 TypeScript
vue3 Vue 3 TypeScript
vue2 Vue 2 TypeScript
lit Lit TypeScript
preact Preact TypeScript
svelte Svelte TypeScript
solid Solid TypeScript
vanilla Vanilla JavaScript TypeScript

Migrate from Existing Projects

If you need to migrate from an existing project to Rsbuild, you can refer to the following guides:

Command Line Interface

Rsbuild comes with a lightweight CLI that includes commands such as dev and build.

package.json
{
  "scripts": {
    // starting the dev server
    "dev": "rsbuild dev",
    // build the app for production
    "build": "rsbuild build",
    // preview the production build locally
    "preview": "rsbuild preview"
  }
}

Refer to the CLI Tool to learn about all available commands and options.

Entry Module

By default, Rsbuild CLI uses src/index.(js|ts|jsx|tsx) as the entry module. You can modify the entry module using the source.entry option.

Next Step

You may want: