This addon will load a reuseable Rsbuild config from Modern.js config file for storybook-builder-rsbuild, which will make Storybook use an coherent configuration with Modern.js.
You could check the example of a Modern.js Application.
You need to install @rsbuild/core
in your project, otherwise the addon may not work as expected.
We recommend installing the version that is consistent with the version in @modern-js/app-tools
. When you install a different version, storybook-addon-modernjs
will give you a warning and recommend the correct version.
.storybook/main.ts
You could check the example of a Modern.js Application with Module Federation.
If you are using Module Federation in Modern.js, you need use @module-federation/storybook-addon
.
.storybook/main.ts
Add the addon, and set the remotes
option.
Now @module-federation/storybook-addon
can not read the remotes
option from the config file in Storybook.
modern.config.ts
When using @module-federation/storybook-addon
, you need to disable the moduleFederationPlugin
in the modern.config.ts
file.
We can use the environment variable to check if the addon is used in Storybook.
Modern.js has its own plugin system, which might internally handle the configurations of Modern.js and Rsbuild.
Modern.js also processes user configurations internally, performing complex transformations before passing them to Rsbuild.
Therefore, the addon has some limitations in Modern.js.
<Link>
navigationconfig
and resolveConfig
hooksWe now support Storybook through a Storybook addon, not a Storybook framework. As a result, some features of Modern.js are unavailable in Storybook.
If you have any questions or suggestions with Modern.js & Storybook, feel free to contact us.