I've created a fresh VueJS application with TypeScript functionality.
When I generate using:
protoc -I=. service.proto --js_out=import_style=typescript:. --grpc web_out=import_style=typescript,mode=grpcwebtext:.
I get the following files:

When I move them to src/_protos in my VueJS project and try to import { PlatformClient } from '@/_protos/ServiceServiceClientPb'; it gives me the following error:
Failed to compile.
./src/_protos/ServiceServiceClientPb.ts
Module not found: Error: Can't resolve './service_pb' in '/Users/theobouwman/dev/woodyshousing/woody_web/src/_protos'
Why is this?
looks like you not resolve it properly at typescript config? You use @ sign, it properly resolve path?
@pumano that resolves to src/
I also have this issue, with and without @ sign.
--js_out=import_style=typescript:.: this doesn't work. The message part of the .proto generated by protoc --js_out= only supports import_style=commonjs or import_style=closure. You need to use the former.
--grpc-web_out=import_style=typescript will output a minimal set of typings for the messages in a .d.ts file.
Thanks @stanley-cheung that fixed it for me
@stanley-cheung what do you mean with "You need to use the former."?
@stanley-cheung what do you mean with "You need to use the former."?
The --js_out parameter doesn't support typescript so what you actually want is:
protoc -I=. service.proto --js_out=import_style=commonjs:. --grpc web_out=import_style=typescript,mode=grpcwebtext:.
Most helpful comment
The
--js_outparameter doesn't supporttypescriptso what you actually want is:See: https://github.com/grpc/grpc-web/issues/411