File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
crates/cli-support/src/js Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -536,13 +536,19 @@ impl<'a> Context<'a> {
536
536
if (typeof WebAssembly.instantiateStreaming === 'function') {{
537
537
result = WebAssembly.instantiateStreaming(response, imports)
538
538
.catch(e => {{
539
- console.warn(\" `WebAssembly.instantiateStreaming` failed. Assuming this is \
540
- because your server does not serve wasm with \
541
- `application/wasm` MIME type. Falling back to \
542
- `WebAssembly.instantiate` which is slower. Original \
543
- error:\\ n\" , e);
544
539
return response
545
- .then(r => r.arrayBuffer())
540
+ .then(r => {{
541
+ if (r.headers.get('Content-Type') != 'application/wasm') {{
542
+ console.warn(\" `WebAssembly.instantiateStreaming` failed \
543
+ because your server does not serve wasm with \
544
+ `application/wasm` MIME type. Falling back to \
545
+ `WebAssembly.instantiate` which is slower. Original \
546
+ error:\\ n\" , e);
547
+ return r.arrayBuffer();
548
+ }} else {{
549
+ throw e;
550
+ }}
551
+ }})
546
552
.then(bytes => WebAssembly.instantiate(bytes, imports));
547
553
}});
548
554
}} else {{
You can’t perform that action at this time.
0 commit comments