When I ran buf generate
on a file that included google/type/date.proto
, a pb file containing a relative path was generated. However, there is no file with the specified path. The language is TypeScript.
// a part of the generated code
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import { Date } from "../google/type/date_pb";
I was expecting it to reference the files output to node_modules
(There was no files related google.type in node_modules
). How can I get rid of the relative paths?
The files used are as follows.
protos/sample/sample.proto
is:
syntax = "proto3";
package sample;
import "google/protobuf/empty.proto";
import "google/type/date.proto";
message Sample {
google.type.Date start_date = 1;
}
service SampleService {
rpc Initialize(google.protobuf.Empty) returns (Sample);
}
buf.yaml
is:
version: v2
modules:
- path: protos
lint:
use:
- DEFAULT
breaking:
use:
- FILE
deps:
- buf.build/googleapis/googleapis:f0e53af8f2fc4556b94f482688b57223
buf.gen.yaml
is:
version: v2
managed:
enabled: true
disable:
- module: buf.build/googleapis/googleapis
plugins:
- remote: buf.build/connectrpc/es:v1.4.0
opt:
- target=ts
- import_extension=none
out: src/gen
- remote: buf.build/bufbuild/es
opt:
- target=ts
- import_extension=none
out: src/gen