Storybook is a tool specifically designed for component debugging. It provides:
Rsbuild provides Storybook Rsbuild, which allows any Rsbuild project to use this tool for building Storybook.
Modern.js implements storybook-addon-modernjs based on this tool. This plugin loads the Modern.js configuration file and converts it into a configuration usable by Storybook Rsbuild.
This document only provides the simplest usage. For more information, please refer to Storybook Rsbuild Modern.js Integration.
npm install @rsbuild/core storybook-builder-rsbuild storybook-addon-modernjs -DYou need to install @rsbuild/core in your project, otherwise the plugin may not work properly.
.storybook/main.tsimport type { StorybookConfig } from 'storybook-react-rsbuild'
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['storybook-addon-modernjs'],
framework: ['storybook-react-rsbuild'],
}
export default configYou can check out the example to learn how to use Storybook in Modern.js.