Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
storybook-builder-rsbuild
Advanced tools
Storybook builder powered by Rsbuild.
Requirements: @rsbuild/core >= 0.6.15
, In Storybook v8, you don't need to manually install storybook-builder-rsbuild, it has been depended by the framework, such as storybook-react-rsbuild and storybook-vue3-rsbuild.
Install storybook-react-rsbuild
.
Change .storybook/main.js
import { StorybookConfig } from 'storybook-react-rsbuild'
const config: StorybookConfig = {
framework: 'storybook-react-rsbuild',
rsbuildFinal: (config) => {
// Customize the final webpack config here
return config;
},
};
export default config;
Now you're all set.
Install storybook-vue3-rsbuild
.
Change .storybook/main.js
import { StorybookConfig } from 'storybook-vue3-rsbuild'
const config: StorybookConfig = {
framework: 'storybook-vue3-rsbuild',
rsbuildFinal: (config) => {
// Customize the final webpack config here
return config;
},
};
export default config;
Now you're all set.
The builder will read your rsbuild.config.js
file, though it may change some of the options in order to work correctly.
It looks for the Rsbuild config in the CWD. If your config is located elsewhere, specify the path using the rsbuildConfigPath
builder option:
// .storybook/main.mjs
const config = {
framework: {
name: 'storybook-react-rsbuild',
options: {
builder: {
rsbuildConfigPath: '.storybook/customRsbuildConfig.js',
},
},
},
}
export default config
You can also override the merged Rsbuild config:
// use `mergeRsbuildConfig` to recursively merge Rsbuild options
import { mergeRsbuildConfig } from '@rsbuild/core'
const config = {
async rsbuildFinal(config, { configType }) {
// Be sure to return the customized config
return mergeRsbuildConfig(config, {
// Customize the Rsbuild config for Storybook
source: {
alias: { foo: 'bar' },
},
})
},
}
export default config
The rsbuildFinal
function will give you config
which is the combination of your project's Rsbuild config and the builder's own Rsbuild config.
You can tweak this as you want, for example to set up aliases, add new plugins etc.
The configType
variable will be either "DEVELOPMENT"
or "PRODUCTION"
.
The function should return the updated Rsbuild configuration.
Because Rspack temporarily does not support the webpackInclude
magic comment, non-story files may be bundled, which could lead to build failures. These files can be ignored using rspack.IgnorePlugin
.
import { mergeRsbuildConfig } from '@rsbuild/core'
module.exports = {
framework: 'storybook-react-rsbuild',
async rsbuildFinal(config) {
return mergeRsbuildConfig(config, {
tools: {
rspack: (config, { addRules, appendPlugins, rspack, mergeConfig }) => {
appendPlugins([
new rspack.IgnorePlugin({
checkResource: (resource, context) => {
const absPathHasExt = extname(resource)
if (absPathHasExt === '.md') {
return true
}
return false
},
}),
])
},
},
})
},
}
module.unknownContextCritical
webpackInclude
magic commentcompilation.dependencyTemplates.set
for react-docgen-typescriptSome codes are copied or modified from storybookjs/storybook.
FAQs
Rsbuild builder for Storybook
We found that storybook-builder-rsbuild demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.