storybook: Not loading - "Loading source..." message
Describe the bug I only see the “loading source…” text in the Storybook tab
.storybooks/webpack.config.js
To Reproduce `module.exports = function({ config }) { config.module.rules.push({ test: /.stories.jsx?$/, loaders: [require.resolve(‘@storybook/addon-storysource/loader’)], enforce: ‘pre’, });
return defaultConfig; };`
addons.js `import ‘@storybook/addon-actions/register’; import ‘@storybook/addon-links/register’; import ‘@storybook/addon-knobs/register’; import ‘storybook-addon-smart-knobs’; import ‘@storybook/addon-storysource/register’;
Folder structure
src /components /stories index.js
`
Expected behavior Expect to see the component code
Screenshots


System:
- OS: [Linux Mint]
- Browser: chrome]
- Framework: [React]
Additional context
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 35 (8 by maintainers)
Faced the same problem. I made it work with the following setup: .storybook/addons.js
.storybook/webpack.config.js
After that story source finally appeared in the storybook. Maybe this would help someone.
I was having the same issue and this configuration fixed it for me:
Try to set
test: /.story.jsx?$/,instead oftest: /.stories.jsx?$/,in your webpack config.or ‘stories.ts’ if you use type script
Try adding story in chain. Like this:
I faced the same issue with storybook 6.
I am planning to move to MDX stories. They have
<Preview>component, which include story source automatically. But I havn’t figured out yet, does it support Typescript, or at least plain Javascript (without React or Vue).https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/mdx.md#writing-stories
This solved my issues with vue 🤟