Open gzm0 opened 3 months ago
Further investigation shows that the difference between a source tsconfig.json
and a generated tsconfig.json
is the files
parameter. If I add it to tsconfig.json
({ "files": ["test.ts"] }
), everything compiles again.
My gut tells me that https://github.com/microsoft/TypeScript/pull/58042 could have changed how relative paths with symlinks are resolved but I cannot find any evidence of that.
I'm currently double-checking that I cannot reproduce this issue without rules_ts.
I have double checked that when running bare typescript (npx tsc
), the error does not occur.
Specifying exclude: []
fixes the issue. It looks like typescript 5.5 adds the outDir
passed via command line to exclude
.
typescript 5.4 doesn't do that as can be shown experimentally (by setting a bogus include pattern):
TS 5.4:
error TS18003: No inputs were found in config file '/home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/sandbox/linux-sandbox/1051/execroot/_main/bazel-out/k8-fastbuild/bin/src/tsconfig.json'. Specified 'include' paths were '["**/*.tsx"]' and 'exclude' paths were '[]'.
TS 5.5 (note the differently reported exclude pattern):
error TS18003: No inputs were found in config file '/home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/sandbox/linux-sandbox/1054/execroot/_main/bazel-out/k8-fastbuild/bin/src/tsconfig.json'. Specified 'include' paths were '["**/*.tsx"]' and 'exclude' paths were '["/home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/sandbox/linux-sandbox/1054/execroot/_main/bazel-out/k8-fastbuild/bin/src"]'.
So a workaround is to override exclude manually.
I filed this upstream: https://github.com/microsoft/TypeScript/issues/59036
TY @alexeagle. Please LMK if there is anything I can help.
For discoverability:
add exclude: []
to your tsconfig.json
.
I'll adopt that workaround to land the new version mirroring: https://github.com/aspect-build/rules_ts/pull/643
We'll see if there's progress from TS team, if not then I'll have to detect the error message and print the workaround :(
It's so gross :( :( https://github.com/aspect-build/rules_ts/pull/646/files
What happened?
Minimal reproducible example below.
With TS 5.5.2, sources cannot be found:
When downgrading to 5.4.5:
Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
None
How to reproduce
MODULE.bazel from above.
BUILD.bazel:
tsconfig.json
.bazelrc
test.ts
Then run
bazel build //:test
Any other information?
The
tsconfig.json
must be a source file.If you do (and optionally delete
tsconfig.json
), the issue vanishes.