rslib-best-practices
Rslib Best Practices
Apply these rules when writing or reviewing Rslib library projects.
Configuration
- Use
rslib.config.tsanddefineConfig - Check Rslib-specific configurations first (e.g.,
lib.*), and also leverage Rsbuild configurations (e.g.,source.*,output.*,tools.*) as needed - For deep-level or advanced configuration needs, use
tools.rspackortools.bundlerChainto access Rspack's native configurations - In TypeScript projects, prefer
tsconfig.jsonpath aliases
CLI
- Use
rslibto build - Use
rslib --watchto build in watch mode for local development - Use
rslib inspectto inspect final Rslib/Rsbuild/Rspack configs
Output
More from rstackjs/agent-skills
rsbuild-best-practices
Rsbuild best practices for config, CLI workflow, type checking, bundle optimization, assets, and debugging. Use when writing, reviewing, or troubleshooting Rsbuild projects.
569rspack-v2-upgrade
Use when upgrading a Rspack 1.x project to v2, including dependency and configuration updates.
238rstest-best-practices
Rstest best practices for config, CLI workflow, test writing, mocking, snapshot testing, DOM testing, coverage, multi-project setup, CI integration, performance and debugging. Use when writing, reviewing, or troubleshooting Rstest test projects.
232rspack-best-practices
Rspack best practices for config, CLI workflow, type checking, CSS, bundle optimization, assets and profiling. Use when writing, reviewing, or troubleshooting Rspack projects.
224rsbuild-v2-upgrade
Use when upgrading a Rsbuild 1.x project to v2, including dependency and configuration updates.
209rsdoctor-analysis
Use when analyzing Rspack/Webpack bundles from local `rsdoctor-data.json` and producing evidence-based optimization recommendations.
164