Storybook: Regression: Slowed Builds with react-docgen-typescript

Created on 4 Sep 2019  路  17Comments  路  Source: storybookjs/storybook

Describe the bug

This is a regression from the resolved state of #6430. It may be an issue with RDTL, perhaps not. They have https://github.com/styleguidist/react-docgen-typescript/issues/112 still open.

In that bug, @strothj and @denieler were able to improve react-docgen-typescript-loader to reuse the parser instance to improve performance. I've updated our dependencies to 5.1.11 and there has been a regression.

Screen Shot 2019-09-04 at 4 19 02 PM

If I comment react-docgen-typescript-loader out, I get much faster build times:

Screen Shot 2019-09-04 at 4 29 26 PM

To Reproduce
Steps to reproduce the behavior:

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

You can view our config here.

performance issue question / support todo typescript

All 17 comments

@clintandrewhall A few questions:
1) Is this a bug with storybook or with the overall experience of using it?
2) You say repo with 10+ stories, but in your config you've excluded *.example.tsx - does this fix the problem?
3) Do you know which files RDTL is running on? Is it possible there are .tsx files in node_modules that are getting unnecessarily processed?

@shilman

  1. I'd say it's a bug that surfaces when adding Typescript documentation to components within stories using react-docgen-typescript/-loader.
  2. I've excluded *.examples.tsx in that portion of the webpack config because without it, react-docgen-typescript tries to glean properties from my Storybook files, (which doubles the time).
  3. I can alter the webpack config to also ignore node_modules... but it's unlikely our dependencies have many .tsx files in them. Additionally, this regressed without a change to that rule.

To be clear: this is exactly like the behavior in #6340, which was quickly solved by the change in RDTL 3.1.1. I was surprised to see it return. I've pored over the code there, and elsewhere, and don't see a clear cause. Rolling back those dependencies has no effect, either.

Excluding node_modules reduced startup time somewhat, about 20s. Is it possible to output how many files were processed?

Screen Shot 2019-09-04 at 10 59 49 PM

@clintandrewhall what do you think about #7942 - loading prop tables from file and generating prop tables manually only when interfaces are changed. Linked in there is also my custom scripts.
Another option i was considering to create a new webpack react docgen plugin that will resemble more the webpack uglify js plugin with caching and parallel execution options.

@atanasster @shilman a prop table cache would be sick.

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!

Any update on this? I don't want this to go stale... it's still a time sync for us.

@clintandrewhall i am getting back from an extended vacation and we discussed with michael to make my scripts into an external webpack plugin. Hopefully soon, but in the meantime you can try my wip scripts as i posted and let me know your input.
If you need help setting up the scripts, please send a message on discord, i will be happy to assist.

@clintandrewhall :
I just released https://github.com/atanasster/webpack-react-docgen-typescript for caching and speed up of parsing typescript prop tables. Feedback and issues welcome to get it stable

@shilman any update as to when this issue will be fixed and what version it will be fixed in?

@The-Code-Monkey yes. we are recommending a new configuration in 6.0 and will be updating the docs this week.

@atanasster Sorry to but in, but since I'm experiencing this issue as well, I thought I'd try your plugin.

Our build time almost doubled. Went from 54sec to 1.8min 馃
I suppose it needs to build up caches. So I gave it one more build, and that time it finished in 52sec. So that's back to where we started. A difference of 2sec over almost a minute is within the margin of error.

Any ideas?

@The-Code-Monkey @thany 6.0 recommendations updated here https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-prop-tables-with-typescript

Excellent! But unfortunately that requires Storybook 6.0, doesn't it?
If only 6.0 would be final. That's why I'm hunting for a solution in 5.3.

@thany I believe it should work with 5.3 as well. Please give it a try!

We've just released zero-config typescript support in 6.0-beta. Please upgrade and test it!

Thanks for your help and support getting this stable for release!

I finished migrating a project from 5.3 to 6.0 and I don't have problem with the TS increased times anymore. The difference is amazing, from ~3 minutes to ~21 seconds:

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purplecones picture purplecones  路  3Comments

tlrobinson picture tlrobinson  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments

wahengchang picture wahengchang  路  3Comments

rpersaud picture rpersaud  路  3Comments