Migration
This guide covers migrating an existing Storybook project from the webpack5 or Vite framework to Storybook Rsbuild (e.g. storybook-react-rsbuild).
Your agent can handle this migration automatically. Install the agent skills and ask it to migrate your project:
Match your Storybook version to the correct storybook-rsbuild release:
From Storybook Webpack5 Framework
If your .storybook/main.ts uses a webpack5 framework package (e.g. @storybook/react-webpack5, @storybook/vue3-webpack5), follow this section.
1. Replace packages
Uninstall the old webpack5 framework package, and install the Rsbuild equivalent along with @rsbuild/core.
For example, to migrate a React project:
Then remove the old packages:
The framework package (e.g. storybook-react-rsbuild) includes storybook-builder-rsbuild as a dependency — you do not need to install the builder separately.
Package mapping
2. Update .storybook/main.ts
3. Convert webpackFinal to rsbuildFinal
mergeRsbuildConfig for modifications
Always use mergeRsbuildConfig from @rsbuild/core to modify the config. Directly mutating properties like config.tools.rspack = {...} may not work because internal configs can be arrays of functions/objects, and direct assignment may be silently ignored.
resolve.alias
Rsbuild resolves alias values relative to the project root. Use './src/components', not path.resolve(__dirname, '../src/components'). The relative form is shorter and avoids __dirname issues in ESM configs.
4. Handle webpack-dependent addons
Some Storybook addons use webpackFinal internally. Move them from addons to webpackAddons:
The webpackAddons field runs each addon's webpackFinal hook and translates the resulting webpack config into Rspack config automatically.
webpackAddons
A few addons hook webpackFinal internally and must move to webpackAddons (or be replaced with the Rsbuild-native equivalent):
@storybook/addon-styling-webpack— global CSS / PostCSS / Sass / Less. Either route viawebpackAddonsor replace with@rsbuild/plugin-postcss,@rsbuild/plugin-sass, or@rsbuild/plugin-less.@storybook/addon-coverage— collects test coverage; route viawebpackAddons.@storybook/preset-create-react-app— CRA compatibility; route viawebpackAddons.
If an addon's name ends in -webpack or its docs mention webpackFinal, assume it needs this treatment. Silently dropping a webpack-only addon is a regression even if storybook build still passes.
5. Convert common webpack patterns
Not all webpack plugins are compatible with Rspack. Check the Rspack compatibility guide for details.
From Storybook Vite Framework
If your .storybook/main.ts uses a Vite framework package (e.g. @storybook/react-vite, @storybook/vue3-vite), follow this section.
1. Replace packages
Uninstall the old Vite framework package, and install the Rsbuild equivalent along with @rsbuild/core.
For example, to migrate a React project:
Then remove the old packages:
Package mapping
2. Update .storybook/main.ts
3. Convert viteFinal to rsbuildFinal
resolve.alias
Rsbuild resolves alias values relative to the project root. Use './src', not path.resolve(__dirname, '../src'). The relative form is shorter and avoids __dirname issues in ESM configs.
4. Convert common Vite patterns
Vite plugins cannot be used with Rsbuild. Find equivalent Rsbuild plugins at the Rsbuild plugin list.
Verification
After migration, verify:
npx storybook devstarts without errors- All stories render correctly
- HMR works (edit a component, see it update)
npx storybook buildcompletes successfully- Addons function correctly (especially docs, controls, actions)
Debugging
Enable Rsbuild debug mode to inspect the generated config:
Check the CLI output to see where the Rsbuild and Rspack configs are written.