question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

grpc-web not working in a Vite+Typescript app

See original GitHub issue

I used protoc -I=. protos/*.proto --js_out=import_style=commonjs,binary:grpcproto_web/ --grpc-web_out=import_style=typescript,mode=grpcweb:grpcproto_web/ to generate my proto file.

Then whenever I try to import proto objects like import { LoginRequest } from '../protos/login_pb'; I get errors Uncaught SyntaxError: import not found: LoginRequest.

I looked at issues #535 or vite#3898 but nothing works.

Does anyone have a working example using Vite+Typescript with grpc-web ?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:14
  • Comments:6

github_iconTop GitHub Comments

7reactions
Krzysztof-Dziardzielcommented, May 31, 2022

@loicmagne You can use @protobuf-ts and protoc --ts_out ./generated --proto_path "./proto" <protoFilesPaths> command. It works fine with Vite.

3reactions
Krzysztof-Dziardzielcommented, May 16, 2022

I’m having the same issue. Sadly, I couldn’t get it to work. I also wasn’t able to get Vite+JS to work. Looks like this is some issue with how Vite loads external resources. 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

does not provide an export named when using vite in grpc ...
I'm trying to use vite. I've some JavaScript-generated files for GRPC communication; alongside each file, there is a declarative file ...
Read more >
Connect-Web: TypeScript library for calling RPC servers from ...
We use it at work, it does indeed address all of the concerns. The problem is gRPC, not protobuf. Twirp does not support...
Read more >
Connect-Web: ergonomic Protobuf & gRPC for browsers
Hi r/typescript ! We've spent a few months working on a TypeScript RPC library and wanted to share. connect-web takes a Protocol Buffer ......
Read more >
JavaScript Weekly Issue 618: December 9, 2022
You can even give it a quick spin online via vite.new. ... npm Gains New Security Features — GitHub continues its work in...
Read more >
grpc - Bountysource
I looked at issues #535 or vite#3898 but nothing works. ... Does gRPC-Web Javascript client application supports gzip compression from gRPC .Net service?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found