Skip to content

ReferenceError: proto is not defined #10

Open
@jzfre

Description

@jzfre

What version of protobuf and what language are you using?
Version: Protocol Buffers v3.19.4
Language: Javascript

What operating system (Linux, Windows, ...) and version?
Linux Debian 11

What runtime / compiler are you using (e.g., python version or gcc version)
Node v12, Node v16

What did you do?
Steps to reproduce the behavior:

  1. Install protoc through Debian package system
  2. Install google/protobufer
  3. Define two different correct ".proto" files
  4. Import one file to another with "import" statement
  5. Run protoc with "protoc --proto_path=./ --js_out=import_style=commonjs,binary:./ *.proto"
  6. JS code is generated, for file that is importing

var something_pb = require('./something_pb.js'); goog.object.extend(proto, something_pb);

7: Import generated files as javascript code:
require("./proto/hello_pb")

  1. Run the code

What did you expect to see

Everything goes fine

What did you see instead?

goog.object.extend(proto, core_pb); ^ ReferenceError: proto is not defined

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions