rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

`js_library` `strip_prefix` fails if prefixed-sources come from `deps`, not `srcs`

Open vpanta opened this issue 3 years ago • 0 comments

🐞 bug report

Affected Rule

The issue is caused by the rule: js_library

Is this a regression?

No, I think it has existed ever since strip_prefix was added.

Description

Today, strip_prefix triggers a failure if you don't at least one source matching that prefix. However, it only checks against the srcs attribute (and legacy node_module_srcs attribute).

This means if you have it forwarding a ts_project's generated sources only, you cannot use strip_prefix.

🔬 Minimal Reproduction

It is late, I'll attempt to get a repro repo set up tomorrow, but in english: Write a js_library which depends on a ts_project generating the prefixed JS, and attempt to use strip_prefix with it.

🔥 Exception or Error


js_library //:foo strip_prefix path does not contain any of the provided sources

vpanta avatar Jul 13 '22 05:07 vpanta