Skip to content

[Bug]: typescript 5.5.2 cannot find input files with source tsconfig.json #644

@gzm0

Description

@gzm0

What happened?

Minimal reproducible example below.

With TS 5.5.2, sources cannot be found:

bazel build //...
INFO: Analyzed target //:test (91 packages loaded, 2863 targets configured).
WARNING: /home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/external/aspect_rules_ts~~ext~npm_typescript/BUILD.bazel:32:17: input 'package' of @@aspect_rules_ts~~ext~npm_typescript//:.aspect_rules_js/node_modules/typescript is a directory; dependency checking of directories is unsound
ERROR: /home/tos/dh/personal/hack/tsc/BUILD.bazel:3:11: Transpiling TypeScript project @@//:test [tsc -p tsconfig.json] failed: (Exit 2): tsc.sh failed: error executing TsProject command (from target //:test) bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/aspect_rules_ts~~ext~npm_typescript/tsc.sh --skipLibCheck --project tsconfig.json --outDir . --rootDir .

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error TS18003: No inputs were found in config file '/home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/sandbox/linux-sandbox/984/execroot/_main/bazel-out/k8-fastbuild/bin/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["/home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/sandbox/linux-sandbox/984/execroot/_main/bazel-out/k8-fastbuild/bin"]'.
Target //:test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.016s, Critical Path: 0.30s
INFO: 4 processes: 3 internal, 1 local.
ERROR: Build did NOT complete successfully

When downgrading to 5.4.5:

bazel build //...
INFO: Analyzed target //:test (90 packages loaded, 2863 targets configured).
WARNING: /home/tos/.cache/bazel/_bazel_tos/287294dcdaea82c1370bff9bd5064654/external/aspect_rules_ts~~ext~npm_typescript/BUILD.bazel:32:17: input 'package' of @@aspect_rules_ts~~ext~npm_typescript//:.aspect_rules_js/node_modules/typescript is a directory; dependency checking of directories is unsound
INFO: Found 1 target...
Target //:test up-to-date:
  bazel-bin/test.js
INFO: Elapsed time: 0.931s, Critical Path: 0.14s
INFO: 2 processes: 1 internal, 1 local.
INFO: Build completed successfully, 2 total actions

Version

Development (host) and target OS/architectures:

Output of bazel --version:

bazel --version
bazel 7.2.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

bazel_dep(name = "aspect_rules_ts", version = "2.4.2")

rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)

rules_ts_ext.deps(
    # TS 5.5.2, broken:
    ts_version="5.5.2",
    ts_integrity="sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew=="
    # TS 5.4.5, works:
    #ts_version="5.4.5",
    #ts_integrity="sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ=="
)

use_repo(rules_ts_ext, "npm_typescript")

Language(s) and/or frameworks involved:

None

How to reproduce

MODULE.bazel from above.

BUILD.bazel:

load("@aspect_rules_ts//ts:defs.bzl", "ts_project")

ts_project(
    name = "test",
    srcs = ["test.ts"],
)

tsconfig.json

{}

.bazelrc

common --@aspect_rules_ts//ts:skipLibCheck=always
common --@aspect_rules_ts//ts:default_to_tsc_transpiler

test.ts

console.log("foo");

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.

 ts_project(
     name = "test",
     srcs = ["test.ts"],
+    tsconfig = {},
 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions