New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storybook does not show any stories! #13811
Comments
You doesn't export any stories. You should maybe add : export const Default = (args) => <Badge {...args}/> The syntax depends on your framework, I assumed it's React. |
@j3rem1e thanks for the advice. But that does still have the same result. No stories showing up. The file now looks like this: import React from 'react';
import { Badge } from './Badge';
export default {
title: 'Badge',
component: Badge,
};
const Story = (args) => <Badge {...args} />;
export const Default = Story.bind({});
Default.args = {
text: '12',
}; |
@devbucket Can you provide a simplified example as a repository someone can pull down and look into? |
@phated Certainly I can. Here you go: https://github.com/devbucket/storybook-example I left the example stories in there to demonstrate that it does not even show these. The only file that is shown is the I also created an example component and added Stories definition to it in |
@devbucket it's some problem with your babel config. when i remove that file, the stories show up fine. |
@shilman The babel config was created by CRA. We can't run the project without it. Is there a possibility to tell Storybook to use another babel config in any way? |
@devbucket is that the default CRA behavior now or did you run it with some special options? you should be able to create a babel config in the |
I found it. It is the |
And it doesn't matter if it sits in the |
To enable fast refresh, you need a webpack plugin and a babel plugin. Actually, we ejected CRA quite a while ago. I was only mentioning this because of that babel config, which came from it originally. I have the webpack plugin installed in my example, so this doesn't seem to be a problem. Only the babel plugin causes an issue here. It would be great if you could check this out. There seems to be an issue with this. |
Is there any news here? We really would love to continue with Storybook and would not want to downgrade to an older version of either Webpack or Storybook. |
The webpack 4/5 builder stuff might have relevance here (unknown??) - We recently released initial support for webpack 5 through an opt-in process. You can check out the details at https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324 🤞 here's to hoping it helps. |
@devbucket when i create a CRA app it doesn't have any babel config in the root directory. so you have a custom babel config in your project root, and you have the ability to modify the babel config however you want in storybook by creating a custom config in the |
@phated thanks, I will give that a try as a last resort. |
@shilman As I already wrote, creating a custom babel config in |
@phated, @shilman - I tried multiple times in every possible way to configure the project to make it work:
Please look at the recent set up at https://github.com/devbucket/storybook-example The only thing that helps is removing |
@phated Any news on this one? |
@devbucket there's definitely a bug here. @ndelangen poked around a bit and we have a workaround, which is to add the following to your module.exports = {
babelDefault: async () => {
return {
compact: true,
presets: ["@babel/preset-env", "@babel/preset-react"],
};
},
} Embarrassingly, we don't know exactly why this is working or why the other solutions are failing. We'll need to spend some time reworking the babel config section of the code, but for now I'm classifying this as "has workaround" and prioritizing the fix. |
I can confirm that this solution works now. At least we can continue with our project. Thank you very much. |
@shilman I'd like to drop all this code in 7.0: storybook/lib/core-common/src/utils/load-custom-babel-config.ts Lines 79 to 93 in 32c6356
in regards to configuration storybook should move towards a world where everything is configured in 1 place: No 'magic' webpack.config.js
|
Closing this in favor of #14425 |
I tried adding Storybook into a newer project. I have used Storybook before, but the last version I was running was
5.3.18
. Today I did a fresh install. But after everything was set up and running, the Storybook app does not show many any of the created stories:The
main.js
looks like this:I have now 1 very simple story in my project that should show up as configured:
The path to it is
./src/common/components/Badge/Badge.stories.js
from the project root. Storybook runs without an issue:And the story is also very simple:
There are no errors reported or anything that could lead me to any potential cause.
The text was updated successfully, but these errors were encountered: