mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 10:10:52 +00:00
Apply the instantiateStreaming
incorrect MIME type recovery for no-modules
It was incorrectly only enabled for the multithreading glue previously.
This commit is contained in:
parent
c30dbc3179
commit
b858875d49
@ -672,7 +672,17 @@ impl<'a> Context<'a> {
|
||||
}} else {{
|
||||
const data = fetch(path_or_module);
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {{
|
||||
instantiation = WebAssembly.instantiateStreaming(data, imports);
|
||||
instantiation = WebAssembly.instantiateStreaming(data, imports)
|
||||
.catch(e => {{
|
||||
console.warn(\"`WebAssembly.instantiateStreaming` failed. Assuming this is \
|
||||
because your server does not serve wasm with \
|
||||
`application/wasm` MIME type. Falling back to \
|
||||
`WebAssembly.instantiate` which is slower. Original \
|
||||
error:\\n\", e);
|
||||
return data
|
||||
.then(r => r.arrayBuffer())
|
||||
.then(bytes => WebAssembly.instantiate(bytes, imports));
|
||||
}});
|
||||
}} else {{
|
||||
instantiation = data
|
||||
.then(response => response.arrayBuffer())
|
||||
|
Loading…
x
Reference in New Issue
Block a user