grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.57k stars 763 forks source link

Could I control the import path in the future? #277

Open purebluesong opened 6 years ago

purebluesong commented 6 years ago

https://github.com/grpc/grpc-web/blob/86631990e365130d5cfca3aa93613ec1eeef7da4/javascript/net/grpc/web/grpc_generator.cc#L349

Here shows the import path is hardcoded as './${basename}_pb'. So it looks like could not put the generated code in others place except the build directory.

For example, there is a proto directory /proto/echo.proto and I want to put the generated code in /MyChildProject/src/api/proto/ when I still could run my build script on /MyChildProject

stanley-cheung commented 6 years ago

There's an out= option. I should probably add it to the docs. Full format for --grpc-web_out=:

--grpc-web_out=import_style=commonjs,mode=grpcwebtext,out=myproject/somename_out.js:./basedir

Oh sorry I misunderstood. You meant, in the generated code, the import path of the proto messages are hardcoded. Yes that's right. Hm, that's tricky.... I will see what I can do.