This relative module was not found, when importing typescript

前端 未结 1 976
一个人的身影
一个人的身影 2021-01-25 19:30

Preemptive note: There are a ton of \"relative module was not found\" questions on Stackoverflow. I have looked through as many as I could find and they are not

相关标签:
1条回答
  • 2021-01-25 20:23

    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:.
    

    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:.
    

    This then generated the foo_pb.js file, and it also generates the foo_pb.d.ts file. I know right, WTF?

    0 讨论(0)
提交回复
热议问题