Gathering detailed insights and metrics for storybook-addon-turbo-build
Gathering detailed insights and metrics for storybook-addon-turbo-build
Gathering detailed insights and metrics for storybook-addon-turbo-build
Gathering detailed insights and metrics for storybook-addon-turbo-build
@storybook/addon-viewport
Build responsive components by adjusting Storybook’s viewport size and orientation
@storybook/addon-controls
Interact with component inputs dynamically in the Storybook UI
@storybook/addon-toolbars
Create your own toolbar items that control story rendering
@storybook/addon-backgrounds
Switch backgrounds to view components in different settings
npm install storybook-addon-turbo-build
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
49 Stars
49 Commits
3 Forks
2 Watching
1 Branches
3 Contributors
Updated on 05 Dec 2023
TypeScript (99.65%)
JavaScript (0.35%)
Cumulative downloads
Total Downloads
Last day
-29.9%
6,453
Compared to previous day
Last week
-8.3%
42,331
Compared to previous week
Last month
10.1%
200,217
Compared to previous month
Last year
-23.6%
2,742,766
Compared to previous year
1
5
A Storybook addon that improves your Storybook build time by tweaking webpack configuration. Compatible with Storybook v6.
Improvements such as replacing Terser with ESBuild or disabling source map generation reduces your build time, so you can save your CI time or operate development cycle more quickly.
This addon does not work with Storybook v7 and later versions. Those newer Storybook versions vastly improved build-time performance by adopting more efficient tools such as Vite or webpack 5. If you want to optimise your build performance further more, please tweak your configuration manually.
Storybook already does various build performance improvements. This addon mainly improves cold build, which is when you build Storybook without caches under your node_modules/.cache
.
There could be barely noticable differences in cache enabled builds. You should evaluate the build time before integrating this addon into your workflow.
1$ npm i -D storybook-addon-turbo-build 2 3# in other package managers 4$ yarn add -D storybook-addon-turbo-build 5$ pnpm i -D storybook-addon-turbo-build
Add this line in your .storybook/main.js
.
1 module.exports = { 2 stories: [ 3 "../stories/**/*.stories.mdx", 4 "../stories/**/*.stories.@(js|jsx|ts|tsx)", 5 ], 6 addons: [ 7 "@storybook/addon-links", 8 "@storybook/addon-essentials", 9+ "storybook-addon-turbo-build" 10 ], 11 };
You can customize modifications to webpack config through preset options.
1// .storybook/main.js 2module.exports = { 3 // ... 4 addons: [ 5 // ... 6 { 7 name: "storybook-addon-turbo-build", 8 options: { 9 // Please refer below tables for available options 10 optimizationLevel: 2, 11 }, 12 }, 13 ], 14};
Option Name | Description | Available Values | Default Value |
---|---|---|---|
optimizationLevel | Level of build speed optimization (See Optimization Levels) | 0 ~ 3 | 1 |
esbuildMinifyOptions | Options for esbuild via ESBuildMinifyPlugin | object (Docs) | { target: "es2015" } |
removeProgressPlugin | Whether to remove ProgressPlugin | boolean | process.env.NODE_ENV === "production" |
disableSourceMap | Whether to disable source map generation | boolean | process.env.NODE_ENV === "production" |
managerTranspiler | Manager Webpack loader configuration that will replace babel-loader with | Object (loader config) or Function (LoaderReplacer ) | Function returns a loader config object for esbuild-loader when Optimization Level >= 2, undefined otherwise |
previewTranspiler | Preview Webpack loader configuration that will replace babel-loader with | Object (loader config) or Function (LoaderReplacer ) | Function returns a loader config object for esbuild-loader when Optimization Level >= 3, undefined otherwise |
LoaderReplacer
LoaderReplacer
is a function that takes loader config object and rule then returns a new loader config object.
Return null
to remove the matching loader instead of to replace.
1// Type Definition 2type LoaderReplacer = ( 3 loader: webpack.RuleSetUseItem, 4 rule: webpack.RuleSetRule 5) => webpack.RuleSetUseItem | null;
1// Replace babel-loader with swc-loader in Preview Webpack 2{ 3 previewTranspiler(loader, rule) { 4 return { 5 loader: "swc-loader", 6 options: {/* ... */} 7 } 8 } 9} 10 11// Simply remove babel-loader from Manager Webpack 12{ 13 managerTranspiler() { 14 return null 15 } 16}
0
No optimization. The preset just returns given webpack configuration.
1
Safe optimizations. You'll get enough build performance boost with this level.
NODE_ENV=production
NODE_ENV=production
2
Aggressive optimizations. This would improve build speed slightly (probably about 1s, depends on machine) and may causes an error if you're using community addons.
babel-loader
with ESBuild in Manager (Storybook UI, Addons)3
Dangerous optimizations. If your project is relying on Babel, this probably will break the build. But will dramatically increases build performance especially when your project has a lot of files (stories).
babel-loader
with ESBuild in Preview (Canvas, Docs Addon)Currently ESBuild does not fully support transpilation to ES5 (yet). If you set optimization level to higher than 1, your bundle might not work on browsers support only up to ES5.
Since the preset replaces Terser with ESBuild, you may observe some file size differences. But it should be very small and does not bring noticable loading performance impact.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More