Closed zoltanbedi closed 5 years ago
Same issue here, we roughly have around 80 components and it take ~5 minutes to start. Unfortunately we haven't found any solution yet.
I've spent the other night trying to solve this. So I found out the slowness is related to https://github.com/styleguidist/react-docgen-typescript/issues/112
I have noticed that the parser creates a new Typescript program (ts.createProgram) a new Parser, which take about 400ms and 150ms each. This of course gets ran once for every component.
Also there was a possible fix for that where you can pass a typescript program as a parameter but I couldn't make it work with the loader. So I've written a webpack plugin that will do the doc generation at the end of the build. It worked. Now it builds in ~17 seconds.
It is not the cleanest code but it works well. You can take a look at it and add it to your project as well. see my pr with the plugin
I'm going to close this issue because my problem is solved. 😃
Cool, thanks. I'm going to leave this open so I remember to look this over.
Wow, such a huge slowness reducement creating a custom program @B3zo0 👏
I think we can close this issue, right @strothj ?
Awesome work @B3zo0 and @denieler . Closing this.
Hey guys,
I was wondering if using this loader is really that slow or I'm doing something wrong. So creating the docs for ~57 components takes about ~1.5 minutes. Without docgen it builds around ~10 seconds. Is there a way to only create these docs for storybook-static and not for start-storybook?