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

[Bug]: Extreme performance regression from Storybook v6 -> v7 #22011

Closed
dhess opened this issue Apr 10, 2023 · 9 comments · Fixed by #22013
Closed

[Bug]: Extreme performance regression from Storybook v6 -> v7 #22011

dhess opened this issue Apr 10, 2023 · 9 comments · Fixed by #22013

Comments

@dhess
Copy link

dhess commented Apr 10, 2023

Describe the bug

On an ubuntu-latest GitHub runner, pnpm storybook build used to take about 3 minutes for our project, but now it takes about 18 minutes. (I see a similar slowdown when running pnpm storybook build locally on an M1 Max MacBook Pro 16", though the absolute times are shorter.)

The project migrated very cleanly, and without any significant issues, using pnpm dlx storybook@latest upgrade. The only bit of the project that required any manual cleanup was our .storybook/main.ts file, because we're using Vite.

To Reproduce

No response

System

Environment Info:

  System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 18.15.0 - /nix/store/kvlngvm6agicknyj02m93zbql3g39kw2-nodejs-18.15.0/bin/node
    npm: 9.5.0 - /nix/store/kvlngvm6agicknyj02m93zbql3g39kw2-nodejs-18.15.0/bin/npm
  Browsers:
    Chrome: 111.0.5563.146
    Firefox: 111.0.1
    Safari: 16.4
  npmPackages:
    @storybook/addon-actions: ^7.0.2 => 7.0.2 
    @storybook/addon-essentials: ^7.0.2 => 7.0.2 
    @storybook/addon-links: ^7.0.2 => 7.0.2 
    @storybook/react: ^7.0.2 => 7.0.2 
    @storybook/react-vite: ^7.0.2 => 7.0.2

Additional context

Our .storybook/main.ts is now more or less straight out of the documentation. The only difference is that we include our stories alongside the component source code:

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

const config: StorybookConfig = {
  stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
  framework: '@storybook/react-vite',
  core: {
    disableTelemetry: true
  },
  docs: {
    autodocs: true
  }
};

export default config;

Our Vite package versions are:

    "vite": "^4.0.4",
    "vite-plugin-checker": "^0.5.6",
    "vite-plugin-dts": "^2.2.0",
    "vite-plugin-package-config": "^0.1.1",
    "vite-plugin-svgr": "^2.4.0",
    "vite-tsconfig-paths": "^4.0.8",
@shilman
Copy link
Member

shilman commented Apr 10, 2023

@dhess do you have a reproduction for this? if anything SB7 should be generally faster than SB6, so it would be great to get to the bottom of what's going wrong in your project

@dhess
Copy link
Author

dhess commented Apr 10, 2023

Unfortunately, no, as the project is private.

@AndrewADev
Copy link

AndrewADev commented Apr 10, 2023

I have a repro repo of this in a project using yarn. It is available here: https://github.com/AndrewADev/storybook-react-ts-vite-slow-build

I set that repo up using a link I found for creating a repro repo (was in the process of submitting an issue myself), which set it up with the latest alpha of v7. I initially discovered this issue in a project with v7.0.2 Storybook though.

Also, this reproduces for me locally, run from within git bash on Windows, as well as hosted in GH Actions (workflow available in the above repo).

My guess was that it seemed to be processing packages from node_modules when it shouldn't be. (I think I may have seen that in a few open issues as well, but not deep enough to know if that is the real cause).

dhess added a commit to hackworthltd/primer-app that referenced this issue Apr 10, 2023
See:

storybookjs/storybook#22011
storybookjs/storybook#22013

Once the latter PR is included in a Storybook release, we can undo
this workaround.
@dhess
Copy link
Author

dhess commented Apr 10, 2023

#22013 looks like it will fix this issue: #22013 (comment)

@dhess
Copy link
Author

dhess commented Apr 10, 2023

Thanks, all, for the remarkably fast turnaround on this!

dhess added a commit to hackworthltd/primer-app that referenced this issue Apr 10, 2023
See:

storybookjs/storybook#22011
storybookjs/storybook#22013

Once the latter PR is included in a Storybook release, we can undo
this workaround.
@shilman
Copy link
Member

shilman commented Apr 11, 2023

ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.1 containing PR #22013 that references this issue. Upgrade today to the @future NPM tag to try it out!

npx sb@next upgrade --tag future

@shilman
Copy link
Member

shilman commented Apr 12, 2023

Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.3 containing PR #22013 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb@latest upgrade

@jerrysandiego
Copy link

I am facing the same issue with SB 7.4, except i am using webpack version 5.88.2. can someone please help?

@jerrysandiego
Copy link

jerrysandiego commented Sep 12, 2023

I am facing the same issue with SB 7.4, except i am using webpack version 5.88.2. can someone please help?

it turns out the following in main.ts didn't work.

core: {
   disableTelemetry: true,
 },

had to add --disable-telemetry flag to storybook build

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

Successfully merging a pull request may close this issue.

5 participants