mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 10:10:52 +00:00
Merge pull request #1243 from fitzgen/instantiateStreaming-fallback-round-2
Apply the `instantiateStreaming` incorrect MIME type recovery for no-modules
This commit is contained in:
commit
db4c3bf77b
@ -662,7 +662,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