Skip to content

Babel compatibility #190

Answered by cortopy
cortopy asked this question in Q&A
Discussion options

You must be logged in to vote

In case anybody lands here, I now got to the bottom of what was happening here.

@protobuf-ts packages are transpiled into ES6, and so classes are left alone as native classes. However, all the generated code from protobuf will extend those classes and webpack/babel will transpile this code. In a default setup, webpack won't pass @protobuf-ts to Babel as node_modules are usually not transpiled again. This means that in my application code generated from protobuf schemas may (or may not) be transpiled to es5, and so a class will become a series of function calls. These functions will call the MessageType constructor as the generated classes extend it. Yet, since MessageType is a native clas…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cortopy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #188 on November 20, 2021 16:48.