-
Notifications
You must be signed in to change notification settings - Fork 72
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
js: protocols bundled with package are incompatible with commonjs_strict #25
Comments
We'd be happy for you to submit a PR for this! |
Both protocolbuffers/protobuf#5464 (Dec 13, 2018, 3 thumbs up) and protocolbuffers/protobuf#6770 (Oct 15, 2019, 8 thumbs up) are similar. I have closed them in favor of this issue, since I think @ChALkeR has provided a great staring point here. |
Javascript implementation of protobuf uses eval (https://github.com/protocolbuffers/protobuf/issues/7778), which isn't allowed in Chrome extensions v3 manifest. But we need v3 manifest to use `chrome.tabGroups` API, so I don't see an easy way to use grpc from a Chrome plugin. And, at the end of the day, we don't really gain that much from grpc in that small kind of project.
Any update on this? |
Seing as @lukesandberg was assigned to this issue. Is it safe to assume there is some traction here @perezd? |
I've created a PR that fixes this issue partially, protocolbuffers/protobuf#8864 fixes the CSP issue, but does not generate the protobufs in |
When generating JS code for .proto files which included well-known types with the commonjs_strict import style, the generated code would import generated JS code for the well-known types with the commonjs import style (located in the google-protobuf NPM package). This causes several issues as discussed in #7778. This CL changes this so when using commonjs_strict, the imported generated JS code for well-known types also uses commonjs_strict. Fixes #7778
@marnixbouhuis I've submitted PR protocolbuffers/protobuf#8955 which complements yours, to generate the well-known types code with the |
It would be nice to merge to master PR protocolbuffers/protobuf#8955 together with the fix of #40 (PR protocolbuffers/protobuf#8696), because otherwise it is possible that it will still be impossible to use this modules generated with |
I just noticed your PR is stuck for review since June :(( It'd be awesome if some maintainer could review all the PRs mentioned in this issue! (#8696, protocolbuffers/protobuf#8864, protocolbuffers/protobuf#8955)
Could you expand on that? Right now I don't notice how this could happen, so I might be missing something. |
According to the example in the comment , there will be extra nesting of package in the export of the js module. So, when you will try to use the current generated modules in another js module by importing them ( |
I'm currently looking at some packaging issues and can take a look at this. |
Any update on this issue? |
i think it would be reasonable to start releasing the well known types in strict mode to npm, a la protocolbuffers/protobuf#8955 |
This issue is about
[email protected]
js package, as published on npm.Currently, it contains the following files:
./google/
protocols are built incommonjs
mode as opposed tocommonjs_strict
, which makes them both pollute the global scope (they create a globalproto
variable) and not compatible with CSP (they useFunction
constructor):I would have expected
commonjs_strict
protocols to be present there, either under the same folder, or perhaps in a separategoogle/protobuf.strict
orstrict/google/protobuf
directory.That would make them usable in
commonjs_strict
mode.The text was updated successfully, but these errors were encountered: