Skip to content
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

Addon-docs: "Unexpected default export without title ...: undefined" Error #7228

Closed
shilman opened this issue Jun 29, 2019 · 3 comments
Closed

Comments

@shilman
Copy link
Member

shilman commented Jun 29, 2019

E.g. in hastebrot/lerna-starter@76d3e4e

Unexpected default export without title in './button/src/__stories__/button.story.mdx': undefined
Error: Unexpected default export without title in './button/src/__stories__/button.story.mdx': undefined
    at http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:14333:17
    at Array.forEach ()
    at http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:14325:18
    at render (http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:6998:13)
    at ConfigApi.configure (http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:7030:9)
    at load (http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:14392:15)
    at load (http://localhost:9001/vendors~main.954b1eeae3d5e00c33c9.bundle.js:15586:19)
    at Module. (http://localhost:9001/main.954b1eeae3d5e00c33c9.bundle.js:40:62)
    at Module../.storybook/config.js (http://localhost:9001/main.954b1eeae3d5e00c33c9.bundle.js:41:30)
    at __webpack_require__ (http://localhost:9001/runtime~main.954b1eeae3d5e00c33c9.bundle.js:786:30)

This fails because the preset only applies to .stories.mdx files and the user named his files .story.mdx.

Options:

  • Update documentation
  • Add .story.mdx support to preset
  • ???
@shilman
Copy link
Member Author

shilman commented Jun 29, 2019

Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-alpha.32 containing PR #7229 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jun 29, 2019
@treshugart
Copy link

treshugart commented Sep 21, 2019

I got tripped up on this because I thought the require.conext call in .storybook/config.js applied to this and I had configured it to something completely different:

import { configure } from "@storybook/react";

configure(
  require.context("../packages", true, /\/examples\/[^\/]+\.(js|md)x?$/),
  module
);

We have an existing codebase that uses a monorepo and has examples/** for stories that don't have .stories (or .story) before the .js or .mdx suffix. Renaming my MDX docs pages to .story.mdx worked.

I assume this is intentional? Could the require.context call also apply to DocsPages?

@shilman
Copy link
Member Author

shilman commented Sep 21, 2019

@treshugart it can if your stories are written in CSF

https://storybook.js.org/docs/basics/writing-stories/#loading-stories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants