Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support generating ES6 specification JS files and using them in grPC-Web #312

Closed
yl-yue opened this issue May 18, 2022 · 6 comments

Comments

@yl-yue
Copy link

yl-yue commented May 18, 2022

Does it support generating ES6 specification JS files and using them in grPC-Web

@sessfeld
Copy link
Contributor

It generates pure TypeScript, from there you can compile it however you like. I'm using @protobuf-ts/grpcweb-transport myself, and I'm more that happy with it.

@yl-yue
Copy link
Author

yl-yue commented May 19, 2022

Thank you for your reply.

Can I understand that I can develop in grpc-web using pure TypeScript and therefore there is no JS file ES6 import problem because there are no (or no need for) JS files

@timostamm
Copy link
Owner

You cannot use protobuf-ts with grpc-web and protoc-gen-grpc-web. Both are hardwired for google-protobuf and protoc --js_out.

But you can use protobuf-ts as a replacement. The transport Sebastian mentioned implements gRPC-web.

And protobuf-ts can generate TypeScript, or JavaScript with ES6 imports and exports, or JavaScript with CommonJS. protoc --js_out can only generate CommonJS. If possible at all, I'd recommend ES6 over CommonJS.

@lotus-x
Copy link

lotus-x commented May 19, 2022

Hi @timostamm,

Are there any concerns to add .js extension to the imports?

@timostamm
Copy link
Owner

It would be pretty great if we could do that - enabled with an option - and make it default some time later. See #182

@lotus-x
Copy link

lotus-x commented May 19, 2022

I see, it's already in progress right.

Thanks for your hard work ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants