更新时间:2021-12-20 22:44:06
好吧,我认为这只是 protoc
中的一个错误.我是这样运行的:
Ok I think this is just a bug in protoc
. I was running it like this:
protoc -I=../../protos/ ../../protos/foo.proto --js_out=import_style=typescript:. --grpc-web_out=import_style=typescript,mode=grpcweb:.
这会创建 foo_pb.d.ts
但它应该也创建 foo_pb.js
.事实上,它为每条消息创建了单独的文件 - memory.js
和 empty.js
.我通过运行以下命令修复"了它:
That creates foo_pb.d.ts
but it should create foo_pb.js
too. In fact it creates separate files for each message - memory.js
and empty.js
. I "fixed" it by running this command:
protoc -I=../../protos/ ../../protos/foo.proto --js_out=import_style=commonjs,binary:. --grpc-web_out=import_style=typescript,mode=grpcweb:.
然后生成了 foo_pb.js
文件,它还生成了 foo_pb.d.ts
文件.我知道对吧,WTF?
This then generated the foo_pb.js
file, and it also generates the foo_pb.d.ts
file. I know right, WTF?