MetaMask / MetaMask/torus-node

Buffer not found in static build using sveltekit and Torus library

Open
#4 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
233
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I need a way to alias Buffer for the browser.

Not sure which module requires this but its probably crypto related.

```
500

Buffer is not defined

@http://localhost:3000/_app/pages/index.svelte-2478ade3.js:1:111754

```

Problem is using Torus node library.

Here is a repo: https://github.com/ralyodio/torus-bufer

```
npm i
npm run build
npm run preview
```

...you will see error. `npm run dev` works fine since node handles requests. Its the browser only environment that is the issue.

The polyfill in `svelte.config.js` appears to not work: https://github.com/ralyodio/torus-bufer/blob/master/svelte.config.js

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the linked torus-bufer repository with npm i, npm run build, and npm run preview. Start by reading svelte.config.js and compare the static preview with npm run dev; done means the browser build runs without the Buffer is not defined error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.