protocolbuffers / protobuf-javascript

BSD 3-Clause "New" or "Revised" License
351 stars 67 forks source link

Global scope pollution in google-protobuf npm library cause conflict between sub dependencies #76

Open hekike opened 6 years ago

hekike commented 6 years ago

The google-protobuf npm library pollutes the global scope through the global.proto variable. This pollution causes conflict between different versions of google-protobuf in the same node process as they overwrites each other.

Reproduce:

If dependency B is required after A, the older version of google-protobuf owervrites the new versions global.proto in the process.

aricart commented 5 years ago

Is there a described mechanism for building a single protobuf library out of the numerous type files that get generated with the new option? While specifying the various options the closure compiler gets hung up on jspb built-in functions, even though I provide the google-protobuf library as a dependency.

Really what is required, is for the compiler to spit a single file that doesn't have global pollution. Any hints, on dealing with protobuf specific dependencies greatly appreciated.