Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts_project with transpiler attribute fails with "target is configured to produce no outputs" #3209

Closed
bazaglia opened this issue Jan 11, 2022 · 2 comments

Comments

@bazaglia
Copy link

🐞 bug report

Affected Rule

ts_project

Description

I'm trying to add the recently implemented transpiler attribute to the ts_project. I'm adding the attribute to an existing target that already works and looks like the following:

ts_project(
    name = "compile_ts",
    srcs = glob(["src/**/*.ts"]),
    out_dir = "build",
    root_dir = "src",
    deps = [
        ...
    ],
)

But when I add the transpiler attribute transpiler = swc, I get the following error:

fail("""ts_project target "//{}:{}" is configured to produce no outputs.

By just removing transpiler it builds again.

🔬 Minimal Reproduction

My WORKSPACE has the relevant rules and the npm package @bazel/typescript has been updated to the version 4.6.0

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "ddb78717b802f8dd5d4c01c340ecdc007c8ced5c1df7db421d0df3d642ea0580",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.6.0/rules_nodejs-4.6.0.tar.gz"],
)

http_archive(
    name = "aspect_rules_swc",
    sha256 = "b58c8f3681215af30842bc3eeec30c9d2047cdf63302bba7d2e86c55a5c77edf",
    strip_prefix = "rules_swc-0.3.1",
    url = "https://github.com/aspect-build/rules_swc/archive/v0.3.1.tar.gz",
)

load("@aspect_rules_swc//swc:dependencies.bzl", "rules_swc_dependencies")

rules_swc_dependencies()

load("@aspect_rules_swc//swc:repositories.bzl", "swc_register_toolchains")

swc_register_toolchains(
    name = "swc",
    swc_version = "v1.2.118",
)

load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")

nodejs_register_toolchains(
    name = "node16",
    node_version = "16.13.1",
)

🔥 Exception or Error

File "/private/var/tmp/.../external/npm/@bazel/typescript/internal/ts_project.bzl", line 851, column 13, in ts_project_macro
		fail("""ts_project target "//{}:{}" is configured to produce no outputs.
Error in fail: ts_project target "//my-target:compile_ts" is configured to produce no outputs.

Note that ts_project must know the srcs in advance in order to predeclare the outputs.

🌍 Your Environment

Operating System:

  
macOS 12.0.1
  

Output of bazel version:

  
Build label: 4.2.2-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jan 1 00:00:00 1980 (315532800)
Build timestamp: 315532800
Build timestamp as int: 315532800
  

Rules_nodejs version:

  
4.6.0
  
@alexeagle
Copy link
Collaborator

Yes, the tsconfig needs to have declarations = true.

I'll add more info to the error message

@alexeagle
Copy link
Collaborator

Fixed error messaging in 5.0. We could backport the fix to a 4.x release but it doesn't seem critical to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants