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:
Storybook 11 removed the React legacy root API. Remove legacyRootApi from framework.options; React 18 or 19 is required.
v4 drops support for legacy peer versions. Upgrade before you move to v4.
@rsbuild/core must resolve to ^2.0.0. Rsbuild 1.x and Rspack 1.x are no longer supported; projects that need them stay on Storybook Rsbuild ^3.
react-native-web must resolve to ^0.19.12 || ^0.20.0 || ^0.21.0 when you use the React Native Web framework; the previous floor was 0.19.0.
@modern-js/app-tools must resolve to ^3.0.0 when you use the Modern.js addon. Modern.js 2 is no longer supported, and @modern-js/plugin-v2 is no longer a peer.
@rslib/core must resolve to >= 0.22.0 when you use the Rslib addon; 0.20 and 0.21 build against Rsbuild 2 pre-releases.
react-docgen and react-docgen-typescript are now optional peer dependencies of storybook-react-rsbuild and storybook-react-native-web-rsbuild, so projects on server-side docgen no longer install them, nor the Babel toolchain that react-docgen brings along. typescript is now a required peer dependency of the React, Vue 3, React Native Web, and Web Components frameworks.
Only projects whose .storybook/main.ts sets features.docgenServer: false are affected. Builder docgen loads these packages only when it runs; if one is missing, storybook dev and storybook build fail with the install command for your package manager. Add the packages for your typescript.reactDocgen mode to devDependencies:
There is no plugin package to install for react-docgen-typescript: storybook-react-rsbuild ships its own plugin. In that mode react-docgen is optional and only documents JavaScript files; without it, JavaScript components get no props, and Storybook does not warn about that. Without a usable typescript (not installed, or TypeScript 7, which has no compiler API), react-docgen-typescript falls back to react-docgen.
Set typescript.reactDocgen: false to run without docgen, or better, remove docgenServer: false to use server-side docgen. Storybook does not add these packages when you upgrade.
htmlLang main-config option removed
htmlLang is no longer a main-config option, to match upstream Storybook, and the preview <html> element is always lang="en". To set a language, use the htmlLang story parameter (parameters.htmlLang), which sets lang on the story root element (story view) or the embedded story canvas (docs view), not on the iframe <html>. Use parameters.docs.lang for the language of docs prose such as descriptions; Storybook's own UI stays English. Both parameters are available since Storybook 10.5 (storybook#35321).
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. List them in webpackAddons. If an addon also provides UI or other preset hooks, keep it in addons too:
Only addons listed in webpackAddons have their webpackFinal run, and only that hook is applied. The returned config is merged into the Rspack config as is, which works because Rspack is compatible with webpack's loader/plugin API.
webpackAddons
A few addons hook webpackFinal internally and must be listed in 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.
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.