dtraft / twirp-rpc-client

Typescript twirp client built for use with ts-proto
0 stars 1 forks source link

ReferenceError: Buffer is not defined at eval #2

Open Jille opened 3 years ago

Jille commented 3 years ago
ReferenceError: Buffer is not defined at eval (webpack-internal:///./node_modules/twirp-rpc-client/dist/protobuf-client.js:37:13)
        return this.axiosClient
            .post(`/${service}/${method}`, data)
            .then((response) => {
            return Buffer ? Buffer.from(response.data) : new Uint8Array(response.data);
        })

I'm not a javascript expert, so I don't understand why it chokes on that.

I'm using this with Vue3. Maybe that enables some strict mode that breaks this?

sgielen commented 3 years ago

Worked around this by adding:

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).Buffer = undefined;

to our main.ts.