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

Progressively Slowed Builds with react-docgen-typescript #6430

Closed
clintandrewhall opened this issue Apr 5, 2019 · 7 comments
Closed

Progressively Slowed Builds with react-docgen-typescript #6430

clintandrewhall opened this issue Apr 5, 2019 · 7 comments

Comments

@clintandrewhall
Copy link
Contributor

clintandrewhall commented Apr 5, 2019

Describe the bug

The documentation for Typescript offers TSDocgen as an option for parsing and providing props tables for stories. In my recent experience, and as noted in an recent issue in react-docgen-typescript, each tsx story is individually parsed and visibly pauses the Storybook build. With each TS story that is added, the build gets slower and slower. With only 10 stories, our build time is ~1.5 minutes... HMR is also impaired.

To Reproduce

Steps to reproduce the behavior:

  1. Enable react-docgen-typescript-loader for .tsx? files, as recommended.
  2. Enable the TSDocgenPlugin, as recommended.
  3. Have a repo with 10+ stories.
  4. See slow build time.

Screen Shot 2019-04-04 at 8 25 44 PM

Commenting out both 1 and 2 in our setup results in ~4s builds:

Screen Shot 2019-04-04 at 8 33 41 PM

Screenshots

Apr-04-2019 20-24-22
Code snippets

You can view our current Storybook config here on Github. I'm currently working on a PR to reduce our payload sizes with a DLL, so this config will change in the coming days/

System:

  • OS: MacOS
  • Device: Macbook Pro 13", latest
  • Browser: Chrome
  • Framework: React
  • Version: 5.0.5

Additional context
I've been discussing this in the Discord channel, under support. It was suggested I log this bug.

@strothj
Copy link

strothj commented Apr 5, 2019

The documentation needs to be updated to reflect that react-docgen-typescript-webpack-plugin should be replaced with react-docgen-typescript-loader. The Webpack plugin was the initial implementation which was later replaced with a loader.

strothj/react-docgen-typescript-loader#40 was just merged in and published as v3.1.0 which should improve the performance. We were creating a TypeScript program instance for each parsed file. The pull request changes this to reuse the same instance.

Can you report what performance you're getting with only the loader installed and with the new version?

@shilman shilman added this to the 5.0.x milestone Apr 5, 2019
@clintandrewhall
Copy link
Contributor Author

@strothj Absolutely. I'll test it and get back to you...!

@clintandrewhall
Copy link
Contributor Author

@strothj BRAVO! Those two changes-- removing the plugin and updating the package-- dropped build time to ~9s.

Screen Shot 2019-04-05 at 8 40 56 AM

@shilman I would recommend updating the documentation for 5.0.5+, depending of course on your own tests.

@shilman
Copy link
Member

shilman commented Apr 5, 2019

@clintandrewhall Would you mind submitting a small PR for that?

@strothj
Copy link

strothj commented Apr 5, 2019

Credit where it's due. @denieler submitted the pull request which fixed that. :)

@stale
Copy link

stale bot commented Apr 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Apr 26, 2019
@stale
Copy link

stale bot commented May 26, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

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

3 participants