Installations
npm install storybook-addon-turbo-build
Developer
pocka
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
NPM Version
Statistics
49 Stars
49 Commits
3 Forks
2 Watching
1 Branches
3 Contributors
Updated on 05 Dec 2023
Languages
TypeScript (99.65%)
JavaScript (0.35%)
Total Downloads
Cumulative downloads
Total Downloads
9,624,998
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
5
storybook-addon-turbo-build
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.
Important note
For Storybook v7 (and later versions) users
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.
For Storybook v6 users
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.
Installation
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
Getting Started
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 };
Configurations
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};
Available Options
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}
Optimization Levels
0
No optimization. The preset just returns given webpack configuration.
1
Safe optimizations. You'll get enough build performance boost with this level.
- Use ESBuild for minification instead of Terser
- Disables source map generation when
NODE_ENV=production
- Disables webpack's ProgressPlugin when
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.
- Replace
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).
- Replace
babel-loader
with ESBuild in Preview (Canvas, Docs Addon)
Limitations
ES5 Transpilation
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.
Bundle size
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
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
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/benchmark.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/benchmark.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-alpha.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/publish-alpha.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-beta.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/publish-beta.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/pocka/storybook-addon-turbo-build/test.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/benchmark.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish-alpha.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish-beta.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 9 are checked with a SAST tool
Score
3.4
/10
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 MoreOther packages similar to 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