Provides shared Rslib configs for library projects: defineBuildConfig, defineDevConfig, defineStorybookConfig, and RslibConfigTransformer. Covers build, watch mode, Storybook setup, bundleless vs bundle output, tsconfig.build.json, type declarations, upgrading to Rslib 2, and migrating from @workleap/tsup-configs.
Ships in wl-web-configs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
@workleap/rslib-configs provides Rslib configurations for library projects. Rslib is powered by Rsbuild and Rspack.
Features: JavaScript, TypeScript, CSS (modules + LightningCSS), React, SVG as components, declaration files (.d.ts), watch mode, source maps.
Target environment: ESM, ESNext
| Function | Use Case |
|---|---|
defineDevConfig | Watch mode for development |
defineBuildConfig | Production build for publication |
defineStorybookConfig | Storybook integration |
pnpm add -D @workleap/rslib-configs @rslib/core
For Storybook, also add:
pnpm add -D storybook-react-rsbuild storybook-addon-rslib
Required for bundleless output (default). The include must point to source files:
// tsconfig.build.json
{
"extends": "@workleap/typescript-configs/library.json",
"include": ["src"],
"exclude": ["dist", "node_modules"]
}
Include source files for debugging with source maps:
{
"files": ["src", "dist", "CHANGELOG.md", "README.md"]
}
// rslib.build.ts
import { defineBuildConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineBuildConfig({
tsconfigPath: path.resolve("./tsconfig.build.json")
});
Note: tsconfigPath is required when using bundleless output (the default). It tells Rslib which files to include based on the tsconfig's include field.
| Option | Type | Default | Description |
|---|---|---|---|
entry | object | { index: "./src/**" } (bundleless) or { index: ["./src/index.ts", "./src/index.js"] } (bundle) | Entry points |
syntax | string | esnext | Output syntax target |
bundle | boolean | false | Single bundle vs bundleless |
tsconfigPath | string | undefined | Path to tsconfig (required for bundleless) |
dts | object/false | true | Generate .d.ts files |
target | string | web | Output target |
distPath | object | { root: "./dist" } | Output directory (Rsbuild output.distPath) |
plugins | array | [] | Rsbuild plugins |
sourceMap | false/object | { js: "source-map", css: true } | Source maps |
react | true/function | disabled | React transformation |
svgr | true/function | disabled | SVG as React components |
React library:
import { defineBuildConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineBuildConfig({
tsconfigPath: path.resolve("./tsconfig.build.json"),
react: true,
svgr: true
});
Bundled output:
export default defineBuildConfig({
bundle: true,
react: true
});
Node target:
export default defineBuildConfig({
target: "node",
tsconfigPath: path.resolve("./tsconfig.build.json")
});
Custom syntax:
export default defineBuildConfig({
syntax: "es2024",
tsconfigPath: path.resolve("./tsconfig.build.json")
});
Disable declaration files:
export default defineBuildConfig({
dts: false,
tsconfigPath: path.resolve("./tsconfig.build.json")
});
// rslib.dev.ts
import { defineDevConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineDevConfig({
tsconfigPath: path.resolve("./tsconfig.build.json")
});
Note: tsconfigPath is required when using bundleless output (the default).
Same as build config, except:
| Option | Default Difference |
|---|---|
dts | false (disabled in dev) |
sourceMap | { js: "cheap-module-source-map", css: true } |
import { defineDevConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineDevConfig({
tsconfigPath: path.resolve("./tsconfig.build.json"),
react: true
});
// .storybook/rslib.config.ts
import { defineStorybookConfig } from "@workleap/rslib-configs";
export default defineStorybookConfig();
// .storybook/main.ts
import type { StorybookConfig } from "storybook-react-rsbuild";
const storybookConfig: StorybookConfig = {
framework: "storybook-react-rsbuild",
addons: ["storybook-addon-rslib"],
// Relative to the ".storybook" folder, adjust to where the stories are located.
stories: ["../../src/**/*.stories.(tsx|mdx)"]
};
export default storybookConfig;
| Option | Type | Default |
|---|---|---|
plugins | array | [] |
sourceMap | false/object | { js: "cheap-module-source-map", css: true } |
react | false/function | enabled |
svgr | false/function | enabled |
import { defineBuildConfig, type RslibConfigTransformer } from "@workleap/rslib-configs";
import type { RslibConfig } from "@rslib/core";
import path from "node:path";
const customTransformer: RslibConfigTransformer = (config: RslibConfig, context) => {
if (context.environment === "build") {
// modify config
}
return config;
};
export default defineBuildConfig({
tsconfigPath: path.resolve("./tsconfig.build.json"),
transformers: [customTransformer]
});
Context: environment ("dev" | "build" | "storybook")
{ "dev": "rslib build -w -c ./rslib.dev.ts" }
{ "build": "rslib build -c rslib.build.ts" }
{
"dev": "storybook dev -p 6006",
"build": "storybook build"
}
// src/env.d.ts
declare module '*.svg' {
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
}
declare module '*.svg?react' {
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
export default ReactComponent;
}
// src/env.d.ts
/// <reference types="@rsbuild/core/types" />
Note: Reference @rsbuild/core, not @rslib/core.
Bundleless (default, recommended): Outputs individual files matching source structure. Better for tree-shaking by consuming bundlers.
Bundle: Outputs a single file. Bundlers must tree-shake within the file, which is less predictable.
// Bundleless (default)
export default defineBuildConfig({
bundle: false, // default
tsconfigPath: path.resolve("./tsconfig.build.json")
});
// Bundle
export default defineBuildConfig({
bundle: true
});
{
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"tasks": {
"dev": {
"dependsOn": ["^build"],
"cache": false,
"persistent": true
},
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "storybook-static/**"]
}
}
}
{
"dev-lib": "turbo run dev --filter=./packages/lib",
"build-lib": "turbo run build --filter=./packages/lib"
}
@workleap/rslib-configs v2.0 tracks Rslib 1.0+ (Rsbuild 2.0 / Rspack 2.0). No public API of defineBuildConfig, defineDevConfig, or defineStorybookConfig changed in this release — most changes are upstream.
20.19+ or 22.12+ required (Node.js 18 is no longer supported). Pin the version in .nvmrc so CI runners and local environments match.pnpm add -D @workleap/rslib-configs@^2.0.0 @rslib/core@^1.0.3@rsbuild/core is now pure ESM — import it from ESM files.experiments.advancedEsm is now the default (the option is ignored); remove it if previously set via a transformer.StartServerResult → StartDevServerResult in @rslib/core.@workleap/tsup-configs to @workleap/rslib-configsdefine*Config functions are thin wrappers; use a transformer for anything the predefined options don't covertsconfigPath pointing at tsconfig.build.json@workleap/tsup-configs for new and existing librariesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
/wl-web-configs:workleap-rslib-configsfrom wl-web-configs
npx claudepluginhub workleap/wl-web-configs --plugin wl-web-configs10 skills in this plugin
/workleap-browserslist-configWorkleap's shared Browserslist config (`@workleap/browserslist-config`). Use when adding or customizing a `.browserslistrc` in a project that uses `@workleap/browserslist-config`, adding custom browser targets, listing the supported browser versions, or deciding whether a project (application vs library) should include Browserslist at all.
/workleap-chromatic-best-practicesWorkleap's Chromatic best practices for snapshot cost control and CI optimization. Use when auditing, setting up, or fixing Chromatic configurations — including TurboSnap-disabling patterns, CI workflows, chromatic.config.json, and monorepo setups. Also activate when reviewing PRs that touch Storybook or Chromatic-related files.
/workleap-react-best-practicesReact performance optimization guidelines for Single Page Applications (SPA) at Workleap. Use when writing, reviewing, or refactoring React SPA code. Covers async waterfall elimination, bundle size reduction, re-render optimization, rendering efficiency, JS micro-optimizations, and advanced patterns. Activate even for small component changes — performance regressions compound silently. Does not cover SSR, Next.js, or server components./workleap-rsbuild-configsWorkleap's shared Rsbuild configs for web applications (`@workleap/rsbuild-configs`): `defineDevConfig`, `defineBuildConfig`, `defineStorybookConfig`, and `RsbuildConfigTransformer`. Use when setting up, customizing, or troubleshooting the dev server, production build, or Storybook of a web application that uses `@workleap/rsbuild-configs`, adding SVG / CSS Modules type declarations, configuring Turborepo tasks, upgrading to Rsbuild 2, or migrating an application from `@workleap/webpack-configs`.
/workleap-skill-optimizerOptimize agent skills to reduce context bloat while preserving answer coverage. Use when a skill's body exceeds ~250 lines, duplicates its references, has a verbose description, or triggers false positives. Also activate proactively when reviewing any skill with both a body and reference files.
/workleap-skill-safety-reviewEvaluate third-party agent skills for security risks before adoption or update. Use when installing, updating, or auditing skills from any source (skills.sh, ClawHub, public registries, PRs). Also activate when building allowlists, investigating suspicious behavior, or answering "is this skill safe?"