question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser support for `std/hash`

See original GitHub issue

I am trying to call createHash() from a bundled library loaded in a web browser, but the bundled JavaScript file has to compile WASM that the browser reports is too big for the main thread:

Uncaught RangeError: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread. at issue.bundle.js:253

Description of demo files attached in WebAssembly.Compile_issue.zip:

  • issue.ts:
import { createHash } from "https://deno.land/std@0.106.0/hash/mod.ts";

const hash = createHash("sha256");
hash.update("Some data to be hashed");
console.log(hash.toString());
  • issue.bundle.js: Generated via deno bundle issue.ts issue.bundle.js. The line 253 of concern is
const wasmModule = new WebAssembly.Module(decode("AGFzbQEAAAAB   [...]
  • issue.html: Imports the JS bundle via <script type="module" src="issue.bundle.js"></script>

Serving and browsing to issue.html results in the above error regarding WebAssembly.Compile.

If I’m expecting too much of the bundler here, what’s the simplest workaround to be able to call createHash() from a library loaded in a browser? Thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lino-levancommented, Oct 27, 2022

This issue should probably be closed. std/hash has been removed from std.

0reactions
cjihrigcommented, Oct 28, 2022

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Location API: hash | Can I use... Support tables for ... - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
StdHash, Tie::ExtraHash - base class definitions for tied hashes
Tie::Hash has legacy support for the new method: it is used if TIEHASH is not defined in the case a class forgets to...
Read more >
Supported Browsers - UBC's Learning Technology Hub
Google Chrome Safari Find out which browser versions are supported Google Chrome Safari Canvas Yes Yes¹ ComPAIR Yes Yes edX Edge Yes Yes All edX Edge...
Read more >
Supported Browsers : State of Oregon
To ensure the safety & security of your browsing experience, Oregon.gov websites are compatible with most popular web browsing software.
Read more >
Which browsers work with Microsoft 365 for the web and ...
Browser support for Microsoft 365 for the web and Microsoft 365 Add-ins. ... Note: Microsoft 365apps and services will not support Internet Explorer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found