aspect-build / aspect-build/rules_ts

[Bug]: Strip import prefixes not handled correctly in ts_proto_library

Open
#875 4 comments 1 reaction 1 assignee Claimed by @alexeagle View on GitHub
bug
Dominant language
Starlark
Stars
138
Forks
87
Avg merge
2d 8h
Merged PRs (30d)
3

Description

### What happened?

The `ts_proto_library` rules does not have handling for `strip_import_prefix` (And probably not `import_prefix`?).

If you use `strip_import_prefix` the `import` statements in the generated js/d.ts files are wrong since the prefix also gets stripped from the relative import paths. The import paths should not be stripped since the real source files are not moved when using `strip_import_prefix` but bazel just creates a virtual folder structure that makes it possible for the protoc compiler to resolve proto imports that have stripped prefixes.

I'm not sure how to solve this but I'm fairly sure that this has to be handled in `ts_proto_library` since `strip_import_prefix` is just a Bazel-ism.

### Version

Development (host) and target OS/architectures: MacOS

Output of `bazel --version`: 8.3.1

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
Latest rules_js/rules_ts

Language(s) and/or frameworks involved:
JavaScript, TypeScript, Protobuf

### How to reproduce

```shell

```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.