Rebuild project using Rspack

In Babylon Editor & Babylon Toolkit I mentioned the old project template was using webpack and it was very slow, and because it uses many old techs, the vite migration is very hard.

I was told that rspack supports webpack well. So I tried to migrate the project to rspack. It was super easy.

Install rsbuild in the project

yarn add @rsbuild/core @rsbuild/plugin-react

Add scripts in package.json

{
  "scripts": {
    "build": "rsbuild build",
    "dev": "rsbuild dev --open",
    "preview": "rsbuild preview"
  }
}

Add rsbuild.config.ts

import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';

export default defineConfig({
  plugins: [pluginReact()],
});

Then everything works, you do not event need an “index.html” file.