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?
I believe this is resolved in https://github.com/grpc/grpc-web/issues/431.
In short, --js_out=import_style=typescript:.
is not supposed to work. You need to do --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.