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

Storybook build fails mysteriously #13778

Closed
cinnamennen opened this issue Jan 31, 2021 · 1 comment
Closed

Storybook build fails mysteriously #13778

cinnamennen opened this issue Jan 31, 2021 · 1 comment

Comments

@cinnamennen
Copy link

Describe the bug
Whenever I try to build storybook, I simply get

ERR! Unexpected token (18:4)
ERR! | try {
ERR! |     // @ts-ignore
ERR! |     default.Header.displayName = "default.Header";
ERR! |     // @ts-ignore
ERR! |     default.Header.__docgenInfo = { "description": "", "displayName": "default.Header", "props": {} };

To Reproduce
I've created https://github.com/cinnamennen/storybook-broken-example as a minimal example of what's going on. I suspect that the subcomponent doesn't play nice with the docgen, but don't have any concrete proof.

Expected behavior
The build to succeed.

System

Environment Info:

  System:
    OS: macOS 11.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
    npm: 6.14.9 - ~/.nvm/versions/node/v14.15.3/bin/npm
  Browsers:
    Chrome: 88.0.4324.96
    Firefox: 72.0.2
    Safari: 14.0.2
  npmPackages:
    @storybook/addon-actions: 6.1.15 => 6.1.15
    @storybook/addon-essentials: 6.1.15 => 6.1.15
    @storybook/addon-knobs: 6.1.15 => 6.1.15
    @storybook/addon-links: 6.1.15 => 6.1.15
    @storybook/core: 6.1.15 => 6.1.15
    @storybook/node-logger: 6.1.15 => 6.1.15
    @storybook/preset-create-react-app: 3.1.5 => 3.1.5
    @storybook/preset-typescript: 3.0.0 => 3.0.0
    @storybook/react: 6.1.15 => 6.1.15
    ```
@shilman
Copy link
Member

shilman commented Feb 1, 2021

Closing as a duplicate of #9556

Possible workarounds:

  • Use named exports instead of default exports, e.g. export class Modal ...
  • Turn off react-docgen-typescript in main.js:
module.exports = {
  typescript: {
    reactDocgen: "react-docgen",
  },
};

I've confirmed both workarounds.

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