Replies: 24 comments
-
|
I’m a little confused by the issue. Is this a feature request to include stories.mdx in the pattern? |
Beta Was this translation helpful? Give feedback.
-
|
Sorry I wasn't quite clear enough. To me the fact that I've specified a different pattern in my config for mdx story files and that pattern isn't being properly recognised feels like a bug. The request is that the pattern I've provided be respected. 😁 If alternatively there's a different way that I should be specifying the pattern for stories MDX files then that's fair enough - in which case it's a documentation bug. |
Beta Was this translation helpful? Give feedback.
-
|
It’s documented that you should name your MDX story files It’s a really interesting proposition to use the @ndelangen any idea about the cleanest way access to this user’s main.js |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the quick responses. As a bit more background, I'm building a new component library - and repeating patterns I've used before which have proved useful/sensible. 😁 One pattern I'd used on an earlier project was to make components as self-contained as practical - that meant one folder per component, containing With the new library I'm of course using the latest storybook - and so far it's all been great. Storybook docs using MDX is fantastic and you guys have done brilliant work. The work-around to name my stories file as something like |
Beta Was this translation helpful? Give feedback.
-
|
That makes total sense. Our recommended naming convention is It's an easy change to update the default pattern to support that convention, and I'll probably make that change. cc @tmeasday @ndelangen But I also really like your suggestion to automatically configure it based on |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
I'm looking at the internal webpack config and see the following rules can we mirror the mdx to |
Beta Was this translation helpful? Give feedback.
-
|
@Pyrolistical can you elaborate on that? |
Beta Was this translation helpful? Give feedback.
-
|
I'm saying this line If do the same for mdx, then that will add support for |
Beta Was this translation helpful? Give feedback.
-
|
I have the same problem, I want to use the exactly same folder structure for my components. Is it possible changing the webpack configuration? |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
I just ran into this. |
Beta Was this translation helpful? Give feedback.
-
|
@shilman I think I came up with a solution to this. I'm thinking we convert the glob patterns specified in And add it to the excludes for the other mdx loader? |
Beta Was this translation helpful? Give feedback.
-
|
I feel we can try to do this for 6.1 |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
I also just ran into this when trying to name a story with just Currently I'm forced to name story files |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
Beta Was this translation helpful? Give feedback.
-
|
I just ran into this as well. Definitely still a bug and this issue should be reopened! Guess I'll go ahead and rename all of my story files... |
Beta Was this translation helpful? Give feedback.
-
|
I just ran into this as well and it is really confusing as this is documented in a confusing way. I am sure that this issue should be re-opened. |
Beta Was this translation helpful? Give feedback.
-
|
@anicholls you can use this as a temporary workaround: This can be used as a temporary workaround in your webpack config: |
Beta Was this translation helpful? Give feedback.
-
|
Would be awesome to be able to have different patterns. My use case is having designer specific documentation living alongside the story documentation. This second mdx file doesn't actually include any stories in it so being able to name it |
Beta Was this translation helpful? Give feedback.
-
|
I'm running into this same issue with |
Beta Was this translation helpful? Give feedback.
-
|
Converting this to a discussion. We’re reserving feature issues for things that are on our short-term roadmap. We’ll check back periodically to see whether this is a good candidate to be added. If this feature would be useful to you, please upvote! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
I decided that I'd name my storybook files
stories.mdx(and have them sit in a directory besidesindexandtestfiles). Unfortunately doing so results in storybook failing, showing an error that readsUnexpected default export without title: undefinedTo Reproduce
Steps to reproduce the behavior:
In
.storybook/main.jsset up the search path forstoriesto look for differently named files - in my case this was:Then make sure you have a valid stories file named
stories.mdx.Restart storybook and you'll see an error.
(You can try other naming formats too - I've tried replacing
storieswith a different word, for example, so it would match*.testword.mdxand that results in an identical error.)Looking at the transpiled output of the mdx files from sources panel in Chrome inspector I can see that the output of a file that is not named following the
*.stories.mdxpattern omits everything beyond a line readingMDXContent.isMDXComponent = true;compared to working stories. (An import ofassertIsFnandAddContextis also omitted). It is this omission of that code that causes the crash.It would therefore seem that the transpilation is incomplete.
Expected behavior
The pattern given above should match files following the pattern of both
*.stories.mdxand plainstories.mdx, which it does. One would expect mdx stories to be transpiled correctly given the configuration.Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
If applicable, add code samples to help explain your problem.
System:
Additional context
Given the configuration above, as my path matching maintains support for the
*.stories.mdxpattern if I rename a file fromstories.mdxto0.stories.mdxthen it will compile correctly and the error goes away.Beta Was this translation helpful? Give feedback.
All reactions