
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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 1 open source maintainer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.