dominikg / tsconfck

A utility to find and parse tsconfig files without depending on typescript
Other
293 stars 14 forks source link

feat: add findAll and performance improving options to find and parse #41

Closed dominikg closed 2 years ago

dominikg commented 2 years ago

see #40

dominikg commented 2 years ago

@sapphi-red what do you think. Would this help with your situation? vite needs to adopt this after releasing, the changes should be minimal though.

updating the tsConfigPaths cache can be done in this change handler :thinking: https://github.com/vitejs/vite/blob/33f96718dc5d827612c300fb6d0258f1c040f5a1/packages/vite/src/node/plugins/esbuild.ts#L302

dominikg commented 2 years ago

here's how the changes in vite look like https://github.com/dominikg/vite/tree/feat/tsconfck-perf

@sapphi-red: i tried to use local tsconfck/vite with these changes in the repo you mentioned https://github.com/traPtitech/traQ_S-UI but didn't see improvements in times for npm run dev or npm run build. Could you share your benchmark so we can validate this actually matters?

sapphi-red commented 2 years ago

@dominikg Thank you for taking your time.

I also tried this PR's tsconfck and vite and it did not affect build speed. Along trying this, I noticed I was misunderstanding my investigation results. I am very sorry about this.

The way I measured time is to add Date.now() before and after the functions. Now I noticed that these functions are async functions and it is not correct to measure with this way since other functions can be executed parallely.

dominikg commented 2 years ago

don't be sorry. Even if it doesn't affect the final build performance it is still a good thing to reduce fs usage. Especially during build we don't need to traverse the parent directories over and over.

The root option also makes sense for vite imho as using a tsconfig.json outside of the workspace root is very likely an error that should be fixed.