Skip to content

vue3 vite with arraybuffer. missing module buffer #492

@shiftonetothree

Description

@shiftonetothree

vue3 vite with arraybuffer. missing module buffer

Shareable Source

const response = await fetch(
    'https://abc.abc.abc/xxx.lerc'
  );
  console.log(response)

Error Message & Stack Trace

VM23117:1 Uncaught ReferenceError: Buffer is not defined
    at eval (eval at isBufferUtf8Representable (is-buffer-utf8-representable.js:9:31), <anonymous>:1:1)
    at isBufferUtf8Representable (is-buffer-utf8-representable.js:9:31)
    at FetchAdapter.onFetchResponse (index.js:182:29)
    at async FetchAdapter.onPassthrough (index.js:159:22)
    at async FetchAdapter.onRecord (index.js:197:32)
    at async FetchAdapter.handleRequest (index.js:91:13)

Config

Copy the config used to setup the Polly instance:

import { Polly } from '@pollyjs/core';
import FetchAdapter from '@pollyjs/adapter-fetch';
import XHRAdapter from '@pollyjs/adapter-xhr';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

Polly.register(FetchAdapter);
Polly.register(XHRAdapter);
Polly.register(LocalStoragePersister);

const polly = new Polly('<Recording Name>', {
  adapters: ['fetch', 'xhr'],
  persister: 'local-storage'
});

const { server } = polly;

server
.host('https://abc.abc.abc', ()=>{
  server.any().intercept((req, res) => {
    debugger;
    console.log(req,res)
  });
})

Dependencies

Copy the @pollyjs dependencies from package.json:

{
    "@pollyjs/adapter-fetch": "^6.0.6",
    "@pollyjs/adapter-xhr": "^6.0.6",
    "@pollyjs/core": "^6.0.6",
    "@pollyjs/persister-local-storage": "^6.0.6",
}

Environment

Node.js v20.7.0
darwin 22.6.0
npm 10.1.0
yarn 1.22.21

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions