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.

Unable to import WebAssembly modules bigger than 4KB

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When importing WebAssembly modules bigger than 4KB browser throws

RangeError: WebAssembly.Instance is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.instantiate.

If the current behavior is a bug, please provide the steps to reproduce.

Import the WASM module bigger than 4KB.

What is the expected behavior?

The module should be imported and instantiated correctly.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Browser: Google Chrome 64.0.3282.140 (Official Build) (64-bit) Node.js: 8.9.1 webpack: 4.0.0-beta.1 Operating System: macOS 10.13

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

12reactions
mathiasbynenscommented, Apr 13, 2018

We have no plans of removing the size limit from Chrome. Using WebAssembly.{Instance,Module} is a bad practice, and hurts the user experience especially for large modules. Use the WebAssembly.instantiateStreaming pattern instead.

6reactions
jdaltoncommented, Apr 13, 2018

@mathiasbynens Imposing arbitrary limits on APIs is a bad practice. Super disappointed in Chrome’s direction on this. It’s fine to encourage async use but to offer a sync API and then make it broken is super wonky. As discussed in #6433 there are other ways to discourage API without delivering a broken one.

@sokra From the https://github.com/webpack/webpack/issues/6433#issuecomment-368094760 it looks like there’s not supposed to be a 4kB limit in workers. Have you found that to be the case and is that something currently being leveraged by webpack?

Update:

It looks like Chrome 66, due out in a few days, will remove the 4kB limit in workers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webassembly - How to dlopen a side module larger than 4KB?
In your browser, click "Choose File" and select the side/side.wasm file, and then click "loadLibrary" button. You will see the following ...
Read more >
Loading WebAssembly modules efficiently - web.dev
When working with WebAssembly, you often want to download a module, compile it, instantiate it, ... Module for buffers larger than 4 KB....
Read more >
JS Bindings | WASM+Rust Tutorial
The solution I have found works well for me is to make some modifications to the above file. First we want to remove...
Read more >
Using the WebAssembly JavaScript API - MDN Web Docs
This article has taken you through the basics of using the WebAssembly JavaScript API to include a WebAssembly module in a JavaScript ...
Read more >
Pragmatic compiling of C++ to WebAssembly. A Guide.
This article is no intro to WebAssembly itself or why you should use it, ... is disallowed on the main thread, if the...
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