Skip to content

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

@purkhusid

Description

@purkhusid

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

Any other information?

No response

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