protobuf.js
protobuf.js copied to clipboard
error after vite building
protobuf.js version: <^6.11.2>
something undefined after vite building
((Field$6.prototype=Object.create(ReflectionObject$5.prototype)).constructor=Field$6).className="Field";var Enum$9=_enum,types$4=types$5,util$f=util$g.exports,Type$5,ruleRe=/^required|optional|repeated$/;Field$6.fromJSON=function H(C,K){return new Field$6(C,K.id,K.type,K.rule,K.extend,K.options,K.comment)};function Field$6(H,C,K,U,W,G,X){if(util$f.isObject(U)?(X=W,G=U,U=W=void 0
the code has been compressed, but it's easily to see that this is a part of the protobufjs
it work properly in development mode.
no idea
ReflectionObject$5 is undefined
Same problem here. Using SvelteKit (1.0.0-next.202), protobufjs 6.11.2, vite 2.7.3.
Worked around it for now using the minimal build and a static code module. Bit fiddly though because the generated code isn't appreciated by the build either - used this sed command to replace the standard import code with something that works (note that the $$ is due to placement of the command in a makefile):
sed -i -e 's|import \* as $$protobuf from "protobufjs/minimal"|import $$protobuf from "protobufjs/minimal.js"|' $(DATAPATH)/the.proto.js
To be clear for those who may find this helpful but who don't read sed, the command replaces the generated import line
import * as $protobuf from "protobufjs/minimal";
with this:
import $protobuf from "protobufjs/minimal.js";
I found both changes necessary - the slightly different import syntax and the explicit .js file extension. YMMV.
Waiting for good news~
same problem here
same problem here
me too
me too
import * as $protobuf from "protobufjs/minimal"
I found a way to temporarily solve this problem,you can replace
import { roots, Root } from "protobufjs/light";
with
import { roots, Root } from "protobufjs/dist/light/protobuf.min";
i dont konw if this is right,but it does work the now code is import the builded protobufjs,skipped live build phase
import * as $protobuf from "protobufjs/minimal"
I found a way to temporarily solve this problem,you can replace
import { roots, Root } from "protobufjs/light";with
import { roots, Root } from "protobufjs/dist/light/protobuf.min";i dont konw if this is right,but it does work the now code is import the builded protobufjs,skipped live build phase
This is only a temporary workaround
me too
I have a same problem with version 7.0.0 and 6.11.3
TypeError: Cannot read properties of undefined` after `vite build
and undefined is caused by _m0.util and the following import
import * as _m0 from "protobufjs/minimal.js";
In the end, I fixed this issue. Just I imported wrongly in files before building
//import * as _m0 from "protobufjs/minimal.js";
import _m0 from "protobufjs/minimal.js";