Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rsbuild

БесплатноБез исполняемых скриптовНе проверен

Rsbuild is a Rspack-based build tool for web applications with a built-in dev server, TypeScript, CSS and asset support, and 5 to 10 times faster builds than…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Rsbuild — Rspack-Powered Build Tool

Overview

Rsbuild is a build tool from the Rstack team built on Rspack, the Rust bundler that follows webpack's architecture. It gives you a dev server with HMR, production builds, TypeScript, CSS (PostCSS, CSS Modules, Sass and Less through plugins), assets, HTML generation, code splitting and Module Federation with sensible defaults, so a project needs little configuration. Rspack accepts most webpack loaders, which eases migration, but not every webpack plugin works; check each one. Rsbuild v2 (current, 2.x) is a pure ESM package on Rspack v2; the v1 to v2 changes below trip up older configs.

Instructions

1. Create or add

npm create rsbuild@latest          # templates: vanilla, react, vue, lit, preact, svelte, solid
npm add -D @rsbuild/core @rsbuild/plugin-react   # to add to an existing project

Scripts: rsbuild dev (dev server with HMR), rsbuild build (production bundle into dist/), rsbuild preview (serve the build locally). Useful flags: --open, --port 3001, --host (listen on the network), --mode, -c rsbuild.staging.config.ts, --environment web. Rsbuild v2 requires @rsbuild/plugin-react 2.x and @rsbuild/plugin-svgr 2.x alongside @rsbuild/core 2.x.

2. Configuration (v2)

// rsbuild.config.ts
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { pluginSass } from "@rsbuild/plugin-sass";
import { pluginTypeCheck } from "@rsbuild/plugin-type-check";

export default defineConfig({
  plugins: [pluginReact(), pluginSass(), pluginTypeCheck()],
  source: {
    entry: { index: "./src/index.tsx" },
  },
  resolve: {
    alias: { "@": "./src" },              // v2: was source.alias
  },
  output: {
    target: "web",
    distPath: { root: "dist" },
    assetPrefix: process.env.CDN_URL ?? "/",
    polyfill: "usage",                    // default "off"; needs core-js installed
  },
  html: {
    title: "Acme Dashboard",
    template: "./static/index.html",
  },
  server: {
    port: 3000,
    proxy: {
      "/api": { target: "http://localhost:8080" },   // changeOrigin defaults to true in v2
    },
  },
  splitChunks: { preset: "default" },     // v2: replaces performance.chunkSplit
  tools: {
    rspack: (config) => {                 // object form is deep-merged; function form can override
      config.module?.rules?.push({ test: /\.graphql$/, use: "graphql-tag/loader" });
    },
  },
});

polyfill: "usage" or "entry" needs npm add core-js, which is an optional peer dependency in v2. @rsbuild/plugin-type-check runs TypeScript checking in a separate process, so it does not slow the build. Module Federation: set moduleFederation.options, and in v2 install @module-federation/runtime-tools when using Module Federation v1.5 options.

3. Upgrading v1 to v2

  • Node.js 20.19+ or 22.12+; @rsbuild/core is pure ESM; upgrade the React, SVGR and other plugins to their v2 releases (npx taze major --include /rsbuild/ -w).
  • Removed: source.alias (use resolve.alias), source.aliasStrategy (use resolve.aliasStrategy), performance.bundleAnalyze (use Rsdoctor or register webpack-bundle-analyzer via tools.rspack), performance.removeMomentLocale, performance.profile.
  • performance.chunkSplit is deprecated in favour of top-level splitChunks: split-by-experience becomes preset: "default", split-by-module becomes "per-package", single-vendor stays, custom becomes "none".
  • server.host now defaults to localhost (was 0.0.0.0); use --host or set it to reach the server from a phone or another machine.
  • Default browserslist moved to "baseline widely available on 2025-05-01" (Chrome 107, Safari 16); a .browserslistrc or package.json browserslist still wins. Node target defaults to Node 20+.
  • Node builds (output.target: "node") emit ESM and are not minified by default.
  • Proxy: context becomes pathFilter; events use the unified on option.
  • Default decorators version is 2023-11.

4. Migrating

webpack: remove webpack, webpack-cli, webpack-dev-server, add @rsbuild/core, translate webpack.config.js into rsbuild.config.ts, keep custom loaders through tools.rspack, then check each plugin against Rspack's compatibility list. Create React App, Vue CLI and Vite have dedicated migration guides on rsbuild.rs.

Examples

Example 1: "Move our CRA app to Rsbuild"

npm remove react-scripts
npm add -D @rsbuild/core @rsbuild/plugin-react

Add the rsbuild.config.ts above (with source.entry pointing at src/index.tsx and html.template at public/index.html if you use one), change scripts to "dev": "rsbuild dev", "build": "rsbuild build". Result: npm run dev starts at http://localhost:3000 with HMR and npm run build writes hashed files to dist/static/.

Example 2: "Rsbuild build broke after upgrading to 2.x"

Typical errors and fixes: an unknown source.alias

Полный SKILL.md на GitHub

Установить rsbuild в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл rsbuild?

Rsbuild is a Rspack-based build tool for web applications with a built-in dev server, TypeScript, CSS and asset support, and 5 to 10 times faster builds than webpack. Use when a developer asks to set up Rsbuild for React, Vue, Svelte or vanilla projects, migrate from webpack, Create React App or Vite, configure the dev server proxy, code splitting or Module Federation, or upgrade Rsbuild v1 to v2.

Как установить скилл rsbuild?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rsbuild запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rsbuild с