Open
Description
This bug is a rebirth of protocolbuffers/protobuf#9152, which has already been fixed in v3.19.1. It seems the fix hasn't been delivered to the latest version.
What version of protobuf and what language are you using?
Version: v3.20.1
Language: Javascript
What operating system (Linux, Windows, ...) and version?
macOs Monterey v12.3.1
What runtime / compiler are you using (e.g., python version or gcc version)
Node.js v16.13.0
What did you do?
- Run
protoc --js_out=import_style=commonjs,binary:path/to/out/dir --proto_path=. *.proto
- Try to import and use the generated *_pb.js files.
What did you expect to see
Import and use without errors (just as in 3.19.1 - 3.19.4).
What did you see instead?
ReferenceError: window is not defined
14 | var jspb = require('google-protobuf');
15 | var goog = jspb;
> 16 | var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);