Quick Start

Online Example

We provide an online example based on Rsbuild. The example gives an intuitive feel for the build performance of Rspack and the development experience of Rsbuild:

Setup Environment

Before getting started, you will need to install Node.js >= version 16, it is recommended to use the Node.js LTS version.

Check the current Node.js version with the following command:

node -v

If you do not have Node.js installed in current environment, or the installed version is too low, you can use nvm or fnm to install.

Here is an example of how to install via nvm:

# Install Node.js LTS
nvm install --lts
# Switch to Node.js LTS
nvm use --lts

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:

Other Projects

For other types of projects, you can manually install the @rsbuild/core package:

npm
yarn
pnpm
bun
npm add @rsbuild/core -D

Then refer to the guide and documentation to enable the features you need:

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 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: