Storybook Support
See original GitHub issueOn fresh master
branch:
langpavel@lang:~/Projects/work/kriasoft/rsk (master)$ getstorybook
getstorybook - the simplest way to add a storybook to your project.
• Detecting project type. ✓
• Adding storybook support to your "Webpack React" app. ✓
• Preparing to install dependencies. ✓
yarn install v1.3.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > express-graphql@0.6.11" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0".
warning "@storybook/react > babel-preset-react-app@3.1.1" has unmet peer dependency "babel-runtime@^6.23.0".
[5/5] Building fresh packages...
success Saved lockfile.
Done in 37.99s.
• Installing dependencies. ✓
To run your storybook, type:
yarn run storybook
For more information visit: https://storybook.js.org
langpavel@lang:~/Projects/work/kriasoft/rsk (master *%)$ yarn run storybook
yarn run v1.3.2
$ start-storybook -p 6006
info @storybook/react v3.3.12
info
Failed to load ./.env.
info => Loading custom webpack config (extending mode).
webpack built 1c69fbfae66a4977cbea in 5844ms
Hash: 1c69fbfae66a4977cbea
Version: webpack 3.10.0
Time: 5844ms
Asset Size Chunks Chunk Names
static/manager.bundle.js 2.62 MB 0 [emitted] [big] manager
static/preview.bundle.js 469 kB 1 [emitted] [big] preview
static/manager.bundle.js.map 3.21 MB 0 [emitted] manager
static/preview.bundle.js.map 556 kB 1 [emitted] preview
index.html 1.2 kB [emitted]
iframe.html 583 bytes [emitted]
[130] ./node_modules/@storybook/react/dist/server/config/polyfills.js 113 bytes {0} {1} [built]
[288] ./node_modules/@storybook/ui/dist/index.js 2.42 kB {0} [built]
[357] multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/addons.js ./node_modules/@storybook/react/dist/client/manager/index.js 52 bytes {0} [built]
[358] ./node_modules/@storybook/react/dist/server/addons.js 105 bytes {0} [built]
[359] ./node_modules/@storybook/addon-actions/register.js 30 bytes {0} [built]
[484] ./node_modules/@storybook/react/dist/client/manager/index.js 404 bytes {0} [built]
[706] ./node_modules/@storybook/react/dist/client/manager/provider.js 3.31 kB {0} [built]
[711] multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js 64 bytes {1} [built]
[712] ./node_modules/@storybook/react/dist/server/config/globals.js 105 bytes {1} [built]
[713] (webpack)-hot-middleware/client.js?reload=true 7.35 kB {1} [built]
[714] ./node_modules/querystring-es3/index.js 127 bytes {1} [built]
[717] ./node_modules/strip-ansi/index.js 161 bytes {1} [built]
[719] (webpack)-hot-middleware/client-overlay.js 2.21 kB {1} [built]
[724] (webpack)-hot-middleware/process-update.js 4.33 kB {1} [built]
[725] ./.storybook/config.js 2.02 kB {1} [built] [failed] [1 error]
+ 711 hidden modules
ERROR in ./.storybook/config.js
Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.
at createDescriptor (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:158:11)
at /home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:101:12
at Array.map (<anonymous>)
at createDescriptors (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:100:27)
at createPresetDescriptors (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:92:10)
at /home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:78:14
at cachedFunction (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/caching.js:40:17)
at presets (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-descriptors.js:23:68)
at mergeChainOpts (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-chain.js:293:68)
at /home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-chain.js:246:7
at buildRootChain (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/config-chain.js:64:27)
at loadConfig (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/config/index.js:50:53)
at transformSync (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/transform-sync.js:13:36)
at Object.transform (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@babel/core/lib/transform.js:20:65)
at transpile (/home/langpavel/Projects/work/kriasoft/rsk/node_modules/@storybook/react/node_modules/babel-loader/lib/index.js:50:20)
at /home/langpavel/Projects/work/kriasoft/rsk/node_modules/@storybook/react/node_modules/babel-loader/lib/fs-cache.js:118:18
@ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 569 kB 0
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/react/dist/server/index.html.ejs 1.69 kB {0} [built]
[1] ./node_modules/lodash/lodash.js 540 kB {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
Child html-webpack-plugin for "iframe.html":
Asset Size Chunks Chunk Names
iframe.html 568 kB 0
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/react/dist/server/iframe.html.ejs 966 bytes {0} [built]
[1] ./node_modules/lodash/lodash.js 540 kB {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Feature support for frameworks - Storybook
Below is a comprehensive table of what's supported in which framework integration. If you'd like a certain feature supported in your framework, we...
Read more >Community | Storybook: Frontend workshop for UI development
Meet world-class frontend devs · Get support · Storybook's thriving community can help answer your questions. · Search the docs · Ask a...
Read more >First-class Vite support in Storybook - JS.ORG
Storybook first supported Vite in April 2021 (two months after Vite 2.0 was released) with help from community member Eirik Sletteberg.
Read more >Frequently Asked Questions - Storybook - JS.ORG
Can I use Storybook with Vue 3? Is snapshot testing with Storyshots supported for Vue 3? Why are my MDX stories not working...
Read more >Introduction to Storybook for React
Storybook integrates with most popular JavaScript UI frameworks and (experimentally) supports server-rendered component frameworks such as Ruby on Rails.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I personally added Styleguidist and not Storybook. It fits really well with the Component structure of the starter kit. I forked the redux feature and changed some stuff but then also with Readme.md files inside the component folders itself so for example
Forked project with the Link component as example.
I was able to get Storybook working with this configuration:
storybook/config.js
storybook/webpack.config.js
Then in RSKs tools/webpack.config.js I added
ejs
toreScript
:const reScript = /\.(js|jsx|mjs|ejs)$/;
. Its also worth updating its resolve.modules configuration so it is an absolute path:modules: ['node_modules', path.resolve(__dirname, 'src')]
Then alongside any component, such as
components/DatePicker/DatePicker.js
, I create a file calledcomponents/DatePicker/DatePicker.story.js