Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue3 vite with arraybuffer. missing module buffer #492

Open
shiftonetothree opened this issue Dec 19, 2023 · 1 comment
Open

vue3 vite with arraybuffer. missing module buffer #492

shiftonetothree opened this issue Dec 19, 2023 · 1 comment

Comments

@shiftonetothree
Copy link

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

@shiftonetothree
Copy link
Author

yarn add buffer -Dcan solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant