-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Pbjs does not use "import * as ..." for importing js files #1839
Comments
khmseu
pushed a commit
to khmseu/protobuf.js
that referenced
this issue
Aug 3, 2023
AVKurbatov commented 7 months ago Fixed two issues. If protofile uses some Namespace (for example, Test) and it contains some Service with the same name, nested Namespace Test.Test will be generated. This Namespace will contain classes for in and out arguments for the Service (for example Test.Test.Request_in). They can't be used from the same Namespace becouse of names conflict. In this fix names of nested Namespaces are updated. The argument class now will be named Test.TestService.Request_in. To use this mode run pbjs with the flag "-u", "--unify-names". Proto-file can contain imports like import "submodule.proto"; Currently all code from them is included into the result of the protobuf-js generated js-file. So, if we have a lot of imports, the result of generation can be enormous. This can be a problem and it was deeply discussed in the issue protobufjs#1839 (comment). With this fix only content of the requested proto file will be generated. All content from imported protofiles will be imported in the generated js and d.ts files. To use this mode run pbjs and pbts with the flag "--use-imports".
same issue, hope support import submodule.proto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Versions:
protobufjs: 7.1.2,
protobufjs-cli: 1.0.2,
pbjs: 0.0.14,
ptjs: 0.2.4.
Hello!
We have a problem using protobuf-js-cli (pbjs, pbts) and protobuf-js.
In our project we use more than 100 proto files and some of them use more than 20 imports for other proto files.
Protobuf-js-cli generates all the code for importing protofiles into one.
As a result, one of the js files we generated has a size of 60 MB and 300,000 lines of code.
The pbts plugin can't handle this. It just crashes without any error messages and no d.ts file is created.
For other cases, it would be generally convenient for us to use imports in the generated js files instead of
large js files with all the imported code in them.
Could you give some advice? Can we use protobuf-js-cli to generate files without imported code in them?
The text was updated successfully, but these errors were encountered: