繁体   English   中英

找不到VueJS Grpc-Web模块

[英]VueJS Grpc-Web module not found

我已经创建了具有TypeScript功能的全新VueJS应用程序。

当我使用生成时:

protoc -I=. service.proto --js_out=import_style=typescript:. --grpc web_out=import_style=typescript,mode=grpcwebtext:.

我得到以下文件:

在此处输入图片说明

当我将它们移动到我的VueJS项目中的src/_protos并尝试import { PlatformClient } from '@/_protos/ServiceServiceClientPb'; 它给了我以下错误:

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'

为什么是这样?

我相信可以在https://github.com/grpc/grpc-web/issues/431中解决。

简而言之,-- --js_out=import_style=typescript:. 不应该工作。 您需要执行--js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:. --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM