.wasm file is sent as application/octet-stream from the server
Emscripten fails to load its WebAssembly due to an invalid MIME type.
wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
live-server returns application/octet-stream but should return application/wasm.
Software details
- Command line used for launching
live-server:live-server - OS: macOS 10.14.1 Mojave (build 18B50c)
- Node.js version: v10.1.0
-
live-serverversion: 1.2.0
72: var fileExt = ""; 82: fileExt = path.extname(filepath).toLocaleLowerCase(); 83: var match, possibleExtensions = ["", ".html", ".htm", ".xhtml", ".php", ".svg"]; 84: if (hasNoOrigin && (possibleExtensions.indexOf(fileExt) > -1)) { 112: if (fileExt == ".wasm") { 113: res.setHeader('Content-Type', 'application/wasm'); 114: }
@Filyus Huh?
Just fixed for myself, maybe someone will come in handy.
@Filyus Pull request?
Probably.
@Filyus Probably? You're not going to make one?
I have no time. I will be grateful if you do it for me.
@Filyus You have the time to edit the code, but not to make a pull request?
Look, I have no idea what this means:
72: var fileExt = "";
82: fileExt = path.extname(filepath).toLocaleLowerCase();
83: var match, possibleExtensions = ["", ".html", ".htm", ".xhtml", ".php", ".svg"];
84: if (hasNoOrigin && (possibleExtensions.indexOf(fileExt) > -1)) {
112: if (fileExt == ".wasm") {
113: res.setHeader('Content-Type', 'application/wasm');
114: }
I finally did it.
@Filyus Thanks! I hope a maintainer won't mind adjusting the indentation though :p
Workaround: you can upgrade send in your project, and live-server should use it.
npm i [email protected] --save-dev (latest version as of writing)
or npm i send@latest --save-dev
Make sure to restart the live-server and do a hard refresh of your app to avoid a cached wrong-mime-type response.