hello, i common is : protoc -I/home/tusimple/dewei/go/src/googleapis -I. \
--js_out=library=closure:./fe/src/api \
--grpc-web_out=import_style=closure,mode=grpcwebtext:./fe/src/api test.proto
i use import "google/api/annotations.proto"; in my test.proto. but goog is not defined when i use test_bp.js
i use common :
protoc -I/home/tusimple/dewei/go/src/googleapis -I. \
--js_out=import_style=commonjs:./fe/src/api \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:./fe/src/api test.proto
npm run dev found error:
how can i use it? thanks.
I am not sure if I follow your example. But usually for this type of error, you are probably missing a step to "compile" your generated code, together with the grpc-web library code (from npm), into a browser-consumable form.
In the repo you should be able to find some examples on how to do that.
For example, for closure-style import, import_style=closure, you need the closure compiler, something like this
For CommonJS style import, import_style=commonjs, you need some sort of tools like webpack, something like this