Unable to import WebAssembly modules bigger than 4KB
See original GitHub issueDo 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:
- Created 6 years ago
- Reactions:2
- Comments:20 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 theWebAssembly.instantiateStreaming
pattern instead.@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.