Skip to content

[Bug]: Cannot specify files from external repositories in srcs attribute of js_run_binary #2583

@withered-magic

Description

@withered-magic

What happened?

When trying to specify files from external repositories in the srcs attribute of js_run_binary, e.g.

js_run_binary(
    name = "target",
    srcs = ["@file//file"],
    outs = ["out.txt"],
    tool = ":bin",
)

the build will error out with the following message:

Cannot use copy_to_bin to copy downloaded from the external repository <repository>.
Files can only be copied from the source tree to their short path equivalent in the output tree.

It looks like both js_binary and js_library support passing files from external repositories through the no_copy_to_bin attribute, but js_run_binary doesn't have no_copy_to_bin as a parameter. js_run_binary does have the copy_srcs_to_bin parameter available, but this isn't compatible with our use case.

Patching rules_js with this diff seems to function as a workaround for now, but was unsure if this was the ideal implementation for this feature ...

Metadata

Metadata

Assignees

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