-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
commonjs no longer works in Node.js #9152
Comments
I missed this case in my original PR 😅. Noticed it today when I updated google-protobuf. Fixed it in this PR: #9156 |
We are forced to use 3.20.3 (where this bug is still present) because of protocolbuffers/protobuf-javascript#127,
at the start of our |
@nottmey when I do this I have errors such as |
@maelp sorry, no idea. Our generated files don't even contain any access on |
@nottmey I'm using it in a Nodejs environment, but I guess there's another package which is fiddling with globalThis and expects perhaps to find something there then? |
@maelp yes that could be the case |
I was also forced to downgrade, but I was able to work around this issue by using
The generated code doesn't access |
As a result of #8864, the generated commonjs
*_pb.js
files no longer work in a Node.js environment, because it referenceswindow
, which is undefined in Node.js.What version of protobuf and what language are you using?
Version: 3.19.0
Language: JavaScript
What operating system (Linux, Windows, ...) and version?
Windows 10
What runtime / compiler are you using (e.g., python version or gcc version)
Node.js 14.18.1
What did you do?
protoc --js_out=import_style=commonjs,binary:path/to/out/dir --proto_path=. *.proto
*_pb.js
files.What did you expect to see
Import and use without errors (just as prior to 3.19.0)
What did you see instead?
Anything else we should know about your project / environment
N/A
The text was updated successfully, but these errors were encountered: