Progressively Slowed Builds with react-docgen-typescript
See original GitHub issueDescribe 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:
- Enable
react-docgen-typescript-loader
for.tsx?
files, as recommended. - Enable the
TSDocgenPlugin
, as recommended. - Have a repo with 10+ stories.
- See slow build time.
Commenting out both 1 and 2 in our setup results in ~4s builds:
Screenshots
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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
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.https://github.com/strothj/react-docgen-typescript-loader/pull/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?
Credit where it’s due. @denieler submitted the pull request which fixed that. 😃