strothj / react-docgen-typescript-loader

Webpack loader to generate docgen information from Typescript React components.
Other
360 stars 47 forks source link

feat: Reuse typescript program in between parses #40

Closed denieler closed 5 years ago

denieler commented 5 years ago

Because we are not reusing the same Typescript instance while parsing ts files there are this issue https://github.com/styleguidist/react-docgen-typescript/issues/112 and this issue https://github.com/strothj/react-docgen-typescript-loader/issues/37.

So here I've created a code, which reuse the same program in between parses in the same way as in ts-loader it's done (https://github.com/TypeStrong/ts-loader/blob/master/src/servicesHost.ts)

denieler commented 5 years ago

@strothj please review

strothj commented 5 years ago

Awesome. I'll have some time to review this in more detail later today (Sunday).

I think one of the original concerns I had when working on this issue was about potential issues that could occur when using a multi-threaded build (https://github.com/TypeStrong/ts-loader#parallelising-builds). I'm not sure that's a valid concern anyways since the ts-loader docs now mention there's less benefit to doing that.

denieler commented 5 years ago

@strothj hey! :) how is it going? :) can we merge it?

strothj commented 5 years ago

Thanks for the pull request! I've published this as version 3.1.0. Let me know if you have any issues and sorry for the delay.

zoltanbedi commented 5 years ago

~While it does speed up the build I noticed that it is not working with the latest typescript (3.4.1) 😔~ false alarm. it has nothing to do with this package. the problem is in styled components. see: https://github.com/Microsoft/TypeScript/issues/30663

strann commented 5 years ago

@strothj can this change be reflected in the underyling react-docgen-typescript package itself? We are using it directly in a node script and are seeing some very slow compile times as our package grows.