We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
protobuf.js version: 6.8.8
we have two proto file a.proto and b.proto
syntax = "proto3"; package ttt; message A{ string RID = 1; }
syntax = "proto3"; package ttt; message B{ string RID = 1; }
when build with pbjs with two file together, the generated file is ok,$root.ttt.A and $root.ttt.B is set right.
pbjs -t static-module -w es6 a.proto b.proto > ttt.js
when build a.proto and b.proto seperately, each output has reset the $root.ttt
export const ttt = $root.ttt = (() => { /** * Namespace ttt. * @exports ttt * @namespace */ const ttt = {};
so when import one generated js file will overwrite any previous setting with the same package name.
the solution is changing cli/targets/static.js line 132 to below
push((config.es6 ? "const" : "var") + " " + escapeName(ns.name) + " = {};");
to
push((config.es6 ? "const" : "var") + " " + escapeName(ns.name) + " = $root."+escapeName(ns.name)+" || {};");
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
protobuf.js version: 6.8.8
we have two proto file a.proto and b.proto
when build with pbjs with two file together, the generated file is ok,$root.ttt.A and $root.ttt.B is set right.
pbjs -t static-module -w es6 a.proto b.proto > ttt.js
when build a.proto and b.proto seperately, each output has reset the $root.ttt
so when import one generated js file will overwrite any previous setting with the same package name.
the solution is changing cli/targets/static.js line 132 to below
to
The text was updated successfully, but these errors were encountered: