Protobuf: JavaScript: es6 module generation

Created on 5 Feb 2018  路  8Comments  路  Source: protocolbuffers/protobuf

Asking because I couldn't find anything about generating es6 modules instead of closure or common via protoc (https://developers.google.com/protocol-buffers/docs/reference/javascript-generated#package).

Is it possible or on the roadmap?

enhancement javascript

Most helpful comment

Would you accept ES6 support in a pull request?

All 8 comments

Yes it isn't specified anywhere what would be the correct syntax. My guess is this:
protoc --js_out=import_style=es6,binary:${DEST} -I ${SRC} ${PROTO_FILE}

but the code generated isn't showing any imports or exports so it must not be working. Can someone confirm what the correct syntax is?

My version is

$ protoc --version
libprotoc 3.5.0

It doesn't even complain if any random import_stype provide: protoc --js_out=import_style=random,binary:${DEST} -I ${SRC} ${PROTO_FILE}

es6 module isn't supported yet.

Any chance of ES6 imports happening soon?

Currently blocking https://github.com/grpc/grpc-web/issues/237

Are there any news about ES6 support? I am trying to use grpc-web with commonjs in Vue.js, but get an error.

You should consider using https://github.com/thesayyn/protoc-gen-ts. It generates classes ES6 compatible.

Would you accept ES6 support in a pull request?

Why is it considered to be in any way acceptable to still be relying on ES5 code 5 years after its deprecation?

Was this page helpful?
0 / 5 - 0 ratings