storybook: [Bug]: Using typescript: "react-docgen-typescript" breaks source preview

Describe the bug

Using the following in my main config breaks the preview source code.

  typescript: {
    reactDocgen: 'react-docgen-typescript',
  },

Screenshot 2024-03-15 at 09 53 15 Screenshot 2024-03-15 at 09 53 07

To Reproduce

https://stackblitz.com/edit/github-cuvfy3?file=.storybook%2Fmain.ts

System

My local system info


Storybook Environment Info:

  System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 8.15.4 - ~/.nvm/versions/node/v20.11.1/bin/pnpm <----- active
  Browsers:
    Chrome: 122.0.6261.129
    Safari: 17.4
  npmPackages:
    @storybook/addon-a11y: 8.0.0 => 8.0.0
    @storybook/addon-docs: 8.0.0 => 8.0.0
    @storybook/addon-essentials: 8.0.0 => 8.0.0
    @storybook/addon-interactions: 8.0.0 => 8.0.0
    @storybook/addon-mdx-gfm: 8.0.0 => 8.0.0
    @storybook/addon-themes: 8.0.0 => 8.0.0
    @storybook/addon-viewport: 8.0.0 => 8.0.0
    @storybook/blocks: 8.0.0 => 8.0.0
    @storybook/core-server: 8.0.0 => 8.0.0
    @storybook/manager-api: 8.0.0 => 8.0.0
    @storybook/preview-api: 8.0.0 => 8.0.0
    @storybook/react: 8.0.0 => 8.0.0
    @storybook/react-vite: 8.0.0 => 8.0.0
    @storybook/react-webpack5: 8.0.0 => 8.0.0
    @storybook/testing-library: 0.2.2 => 0.2.2
    @storybook/theming: 8.0.0 => 8.0.0
    @storybook/types: 8.0.0 => 8.0.0
    chromatic: 11.0.8 => 11.0.8
    eslint-plugin-storybook: 0.8.0 => 0.8.0
    storybook: 8.0.0 => 8.0.0
    storybook-mock-date-decorator: 1.0.1 => 1.0.1


### Additional context

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 7
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Hey everyone! This issue is solved in #26566 and will be released soon. Thanks for your patience 🙏

Pretty much narrowed it down to the 8.0.0-rc.4 package of @storybook/react. If you downgrade it to rc3 for that package, clear all caches (browser + delete node_modules and run nx reset if using nx, etc) and then npm install it works again.

Maybe this PR: https://github.com/storybookjs/storybook/pull/26382 ?

EDIT: be sure to pin it to 8.0.0-rc.3 (no ^)