storybook: [Bug]: Storybook hangs/doesn't finish building 8.4.6/8.4.7

Describe the bug

We’re using Storybook (with React) in version 8.4.5. I noticed that our Renovate update failed for 8.4.6 and now 8.4.7 as well. I didn’t create a bug ticket so far, because I cannot reproduce it locally and only see it in our CI (Gitlab).

I decided to create a ticket now as I was checking if someone else has the same problem, but I couldn’t find something related. Maybe it helps someone else to jump into the discussion (and ideally a solution later). (https://github.com/storybookjs/storybook/issues/29715 seems to about a different issue.)

Reproduction link

#sorry-😦

Reproduction steps

No response

System

Storybook in the mentioned versions, Gitlab CI and $ node -v v22.11.0.

Additional context

The last output I get after running $ storybook build--output-dir storybook is this:

Generate File to /builds/xxx/yyy/storybook/meta.json info => Preview built (1.33 min) info => Output directory: /builds/xxx/yyy/storybook attention => Storybook now collects completely anonymous telemetry regarding usage. This information is used to shape Storybook’s roadmap and prioritize features. You can learn more, including how to opt-out if you’d not like to participate in this anonymous program, by visiting the following URL: https://storybook.js.org/telemetry

Afterwards my CI job runs into a timeout. As far as

I tried to get more information by using different log levels and --debug, but I couldn’t get more information. I will try to debug more and if I find a solution/workaround I will update (and close) this issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 26
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve updated the library to opt-in to the watch behaviour, this way users will have the old (broken) behaviour by default which should solve the performance issues.

Since this might come up for someone else in our project this issue ended up causing JavaScript heap out of memory error, probably due to the size of many JSON files and general size of the project.

This problem was NOT fixable by switching over from react-docgen-typescript to react-docgen (this caused the hanging issue instead). Also 0.3.0 override did not help either way.

However 0.5.0 did fix the issue:

{
  "overrides": {
      "@joshwooding/vite-plugin-react-docgen-typescript": "0.5.0",
   }
}

The time I spent figuring out this issue is not reflected by the length of this message.

Hey everyone! I’m assuming this might be related to an internal change in typescript docgen (as I noticed most of you have it from your main.js, thanks for sharing!). The new version parses your typescript config to find what to process, instead of glob which was being used before. Sharing your tsconfig files would be useful as well.

Could you please do either of this and share back whether you still have issues in CI. Mind you I’m not asking you to do this as a final solution, just as an experiment to assist us finding whether this is the real cause of the issue:

Use react-docgen instead of react-docgen-typescript

const config: StorybookConfig = {
  typescript: {
    reactDocgen: "react-docgen",
  },
};

export default config;

Downgrade typescript docgen by using package overrides in your package.json

Yarn:

{
  "resolutions": {
      "@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0",
   }
}

NPM:

{
  "overrides": {
      "@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0",
   }
}

PNPM:

{
  "pnpm": {
      "overrides": {
        "@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0",
       }
   }
}

Thank you so much Josh!! Here’s a PR to upgrade the version https://github.com/storybookjs/storybook/pull/30422

I’ve noticed that version 0.4.0 of @joshwooding/vite-plugin-react-docgen-typescript works without issues, while version 0.4.1 causes the build to break. The problem seems linked to this commit: 12793a6.

Additionally, while switching from react-docgen-typescript to react-docgen helps with the hanging build issue, it disrupts the controls addon functionality.

This issue still persists with Storybook 8.5.0.

hey @yannbf thanks for your suggestions. Using react-docgen instead of react-docgen-typescript was enough for us. With no need to downgrade the docgen.

Just adding a comment here to say this is also happening in our app. Haven’t had time to debug further.

System:

  • Storybook: v8.4.6 and v8.4.7
  • React: v18.3.1
  • Node: v22.1.0
  • CI: GitHub Actions

Here is the main.ts:

import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
  stories: ["../src/**/!(guides)/*.mdx", "../src/**/*.stories.@(ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/addon-a11y",
  ],
  framework: {
    name: "@storybook/react-vite",
    options: {},
  },
  docs: {
    autodocs: "tag",
  },
  typescript: {
    reactDocgen: "react-docgen-typescript",
    reactDocgenTypescriptOptions: {
      include: ["src/**/*.tsx"], // https://github.com/storybookjs/storybook/issues/22164#issuecomment-2292959229
    },
  },
};

export default config;

I’m having the same issue

  1. I have added STORYBOOK_DISABLE_TELEMETRY=1 to my environment variables
  2. –no-manager-cache is not an option with build https://storybook.js.org/docs/6/api/cli-options#build-storybook

here is my main.ts

import type { StorybookConfig } from '@storybook/react-vite';
// For help finding packages in monorepo: https://storybook.js.org/docs/react/faq#how-do-i-fix-module-resolution-in-special-environments
function getAbsolutePath(value: string): string {
  return dirname(require.resolve(join(value, 'package.json')));
}

const config: StorybookConfig = {
  stories: [
    '../libs/**/*.stories.@(js|jsx|ts|tsx|mdx)',
  ],
  addons: [
    getAbsolutePath('@storybook/addon-links'),
    getAbsolutePath('@storybook/addon-essentials'),
    getAbsolutePath('@storybook/addon-interactions'),
    getAbsolutePath('@storybook/addon-a11y'),
    getAbsolutePath('@chromatic-com/storybook'),
  ],
  framework: {
    name: getAbsolutePath('@storybook/react-vite') as '@storybook/react-vite',
    options: {
      builder: {
        viteConfigPath: join(__dirname, '..', 'vite.config.storybook.ts'),
      },
    },
  },
  staticDirs: ['./public'],
  docs: {},
  typescript: {
    reactDocgen: 'react-docgen-typescript',
  },
};
export default config;

This is all working with 8.4.5 for me with 8.4.7 just hanging in my pipeline