Rule | Description |
---|---|
node_proto_repositories | Load workspace dependencies. |
node_proto_compile | Generate node js protobuf source files. |
NOTE: These rules are currenty not compatible with the bazel sandbox. To use them you'll have to use
--spawn_strategy=standalone
.
Enable node support by loading the dependencies in your workspace.
IMPORTANT: This should occur after loading rules_node.
load("@org_pubref_rules_protobuf//node:rules.bzl", "node_proto_repositories")
node_proto_repositories()
This is a thin wrapper over the
proto_compile rule having language
@org_pubref_rules_protobuf//node
(common js output of the --js_out
protoc option.
load("@org_pubref_rules_protobuf//node:rules.bzl", "node_proto_compile")
node_proto_compile(
name = "protos",
protos = ["message.proto"],
with_grpc = True,
)
$ bazel build :protos
Target //:protos up-to-date:
bazel-genfiles/message_pb.js
bazel-genfiles/message_grpc_pb.js