1

My example.html contains

...
<script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.8.8/dist/minimal/protobuf.js"></script>
<script type="module">
  import {Task} from "./task.pb.js"
  const msg = Task.create({text: 'test', done: false})
  const bin  = Task.encode(msg).finish()
  console.log(Task.decode(bin))
</script>
...

and my proto file looks like this

syntax = "proto3";

import "google/protobuf/any.proto";

package main;

message Task {
    string text = 1;
    bool done = 2;
}

message Test {
    google.protobuf.Any object = 1;
}

Tried to build the static module like this

pbjs -p . task.proto -t static-module --es6 -w es6 -o task.pb.js

But that doesn't seem to generate a module the browser can understand?

Gert Cuykens
  • 6,845
  • 13
  • 50
  • 84

0 Answers0