typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

tsgo not compiling mono repo projects (and pnpm?)

Open eranbo opened this issue 8 months ago • 5 comments

Created a sample project that reproduce the issues:
https://github.com/eranbo/tsgo-test

About the issues:

  1. When using mono repo with multiple services / modules using base tsconfig.json with references to inner services / modules the tsgo is not following the references array. When running pnpm run build - old compiler works OK.
  2. When changing directory to service and running tsgo - an error occured:
$ tsgo
src/main.ts:3:24 - error TS2307: Cannot find module 'body-parser' or its corresponding type declarations.

3 import bodyParser from 'body-parser';
                         ~~~~~~~~~~~~~


Found 1 error in src/main.ts:3

Files:             176
Lines:           95836
Identifiers:     85140
Symbols:         67853
Types:            2965
Instantiations:   8785
Memory used:    52307K
Memory allocs:  250057
Parse time:     0.034s
Bind time:      0.010s
Check time:     0.012s
Emit time:      0.001s
Total time:     0.057s

When running inside the service folder pnpm exec tsc -b tsconfoig.json - old compiler works OK.

eranbo avatar Apr 20 '25 05:04 eranbo

Project references are not yet supported.

jakebailey avatar Apr 20 '25 06:04 jakebailey

@jakebailey 10x - looking forward for this feature. what about number 2? the error of Cannot find module 'body-parser'?

eranbo avatar Apr 20 '25 08:04 eranbo

Hi,
Just following if there is any news about the 2nd error: src/main.ts:3:24 - error TS2307: Cannot find module 'body-parser' or its corresponding type declarations.

eranbo avatar Apr 24 '25 11:04 eranbo

No news. @EricCornelson has been working on fixing module resolution and the related checker stuff, so it's possible it'll be fixed afterward.

jakebailey avatar Apr 24 '25 15:04 jakebailey

once we have Build mode / project references and ideally Incremental build even if LSP is not there this could still be very useful. one could run go version in watch mode in build mode and this will generate dts files much faster than current tsc, while users will use normal tsc's lsp. i'm looking forward to this being supported

safareli avatar Apr 30 '25 10:04 safareli

For build mode, see #529

Otherwise, I've confirmed that this module resolution bug has been fixed.

jakebailey avatar Jun 04 '25 07:06 jakebailey

Thanks for the update, looking forward for testing it

eranbo avatar Jun 04 '25 10:06 eranbo