What is @storybook/builder-webpack5?
The @storybook/builder-webpack5 npm package is a builder for Storybook that uses Webpack 5 as its core bundling engine. It allows developers to configure Storybook to use Webpack 5 for building and serving their UI component stories. This package is particularly useful for projects that have already migrated to Webpack 5, ensuring compatibility and taking advantage of the latest features offered by Webpack.
Custom Webpack Configuration
Allows users to provide a custom Webpack configuration to be used by Storybook. This can include custom loaders, plugins, and other Webpack-specific settings.
{
"stories": ["./src/**/*.stories.@(js|jsx|ts|tsx)"]
"addons": ["@storybook/addon-links", "@storybook/addon-essentials"],
"core": {
"builder": "@storybook/builder-webpack5"
},
"webpackFinal": (config) => {
// Custom webpack configuration
return config;
}
}
Performance Optimizations
Enables performance optimizations such as lazy compilation to improve the development experience by speeding up build and reload times.
{
"core": {
"builder": {
"name": "@storybook/builder-webpack5",
"options": {
"lazyCompilation": true
}
}
}
}