Problem with using protobuf in vue 3 composition api

I’m trying to use a protobuf file to communicate with a server. I tried to use protobufjs library but I can’t import in vue 3. The documentation says import the library like this:

var protobuf = require("protobufjs");

but there is no "require" in vue 3. What is the workaround to make this work or even is there any other library to use protobuf in vue 3 easily?
I’m beginner in js and any help would be appreciated.
Thanks.