【发布时间】:2018-07-24 18:52:46
【问题描述】:
这是我的npm run protoc,下面的行会运行:
./node_modules/protoc/protoc/bin/protoc --proto_path=proto --js_out=import_style=commonjs,binary:src/bin --grpc_out=src/bin --plugin=protoc-gen-grpc=node_modules/grpc-tools/bin/grpc_node_plugin --ts_out=service=true:src/bin proto/authentication_service.proto
它会生成以下文件:
authentication_service_grpc_pb.js
authentication_service_pb.d.ts
authentication_service_pb.js
authentication_service_pb_service.d.ts
authentication_service_pb_service.js
有一次我能够让它生成一个authentication_service_grpc_pb.d.ts,但是我在上面保存的配置却没有。任何人都可以帮助我缺少什么吗?谢谢!
【问题讨论】:
-
“曾经”和现在之间发生了什么变化?看起来该命令获取了为 js 和 ts 生成文件的参数就好了。你能用输出验证 ts generation 是否正常工作吗?
-
@zamber 老实说,问题是我可能没有提交正确版本的命令。第一次让它生成 authentication_service_grpc_pb.d.ts 花了我一段时间。在过去的两天里,我一直在浏览应该为 authentication_service_grpc_pb.js 生成 TS 文件但没有成功的插件。没有其他任何改变,我保持一切平等,因为目标是为新原型生成一个新集合,并使用现有的进行测试。
标签: node.js typescript grpc