rstackjs avatar

Rsbuild Best Practices

Best-practices guide for writing, reviewing, and troubleshooting Rsbuild config, CLI use, type checks, and bundle size.

skills.sh installs
2.9K
GitHub stars
100
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers config setup with rsbuild.config.ts, CLI usage for rsbuild, build, preview, and inspect, and asset handling rules
  • Includes type-checking options via @rsbuild/plugin-type-check or explicit tsc --noEmit and vue-tsc --noEmit steps
  • Enforces avoiding published .map files when production source maps are enabled, and preferring first-class options over tools.rspack
  • Designed for developers configuring, reviewing, or debugging Rsbuild projects with DEBUG=rsbuild and --cpu-prof profiling

Install

$ npx -y skills add rstackjs/agent-skills --skill rsbuild-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rsbuild best practices

Apply these rules when writing or reviewing Rsbuild projects.

Configuration

  • Use rsbuild.config.ts and defineConfig
  • Use tools.rspack or tools.bundlerChain only when no first-class Rsbuild option exists
  • Define explicit source.entry values for multi-page applications
  • In TypeScript projects, prefer tsconfig.json path aliases first

CLI

  • Use rsbuild for local development
  • Use rsbuild build for production build
  • Use rsbuild preview only for local production preview
  • Use rsbuild inspect to inspect final Rsbuild/Rspack configs

Type checking

  • Use @rsbuild/plugin-type-check for integrated dev/build type checks
  • Or run tsc --noEmit/vue-tsc --noEmit as an explicit script step

Bundle size optimization

  • Prefer dynamic import() for non-critical code paths
  • Prefer lightweight libraries where possible
  • Keep browserslist aligned with real compatibility requirements

Asset management

  • Import source-managed assets from project source directories, not from public
  • Reference public files by absolute URL path

Security

Details

Repository
github.com/rstackjs/agent-skills
Categories
Frontend & UI Code, Technical Documentation
First seen
May 16, 2026

More from rstackjs/agent-skills

All 12

Similar to Rsbuild Best Practices

More Frontend & UI Code