yandeu / five-server-vscode

⚡ VSCode Extension for Five Server.
https://marketplace.visualstudio.com/items?itemName=yandeu.five-server
Other
121 stars 9 forks source link

WASM modules are served with the wrong content-type #4

Closed JKRhb closed 3 years ago

JKRhb commented 3 years ago

Describe the bug As it is the case with live-server, WASM modules are currently not served with the correct content-type but with as application/octet-stream causing an error the client side (also see this issue in the live-server repository).

There is an existing PR in the live-server repository that can be used to fix this issue. Sadly, it is already open for more than a year :/ It would be awesome if you could fix this problem in your fork :)

yandeu commented 3 years ago

Hi @JKRhb

Thanks for letting me know. I will have a look this evening 👍🏻

Can you please just point me to a simple wasm file/project to test it?

yandeu commented 3 years ago

Sure it doesn't work? I just tested an application and it served the wasm file with Content-Type: application/wasm.

JKRhb commented 3 years ago

Thank you for your fast response!

Sure it doesn't work? I just tested an application and it served the wasm file with Content-Type: application/wasm.

Hmm, maybe it is in fact a problem with my setup (I am trying to compile a Rust project to wasm using wasm-bindgen). I will investigate this a bit more :)

Could you on the other hand maybe give me a link to the application you have tested? :)

yandeu commented 3 years ago

Could you on the other hand maybe give me a link to the application you have tested? :)

I served the src folder of https://github.com/enable3d/enable3d-website. There is an ammo.wasm file for the 3D Physics.

markringo commented 3 years ago

I got the same issue with the LS version 5.6.1. I compiled the https://github.com/google/monster-mash and the webpage simply fetch a wasm via js and the content-type is wrong, however the js somehow fall back to another load method upon the exception and the app works despite still showing these errors. I'm using Chrome 91

yandeu commented 3 years ago

Hmm, I just fetched https://monstermash.zone/ and run it with five-server. In the network tab of chrome I see:

Request URL: http://127.0.0.1:5500/monstermash.wasm
Content-Type: application/wasm

This is what I did to test it:
The website did not work, but the wasm file successfully loaded with 'application/wasm'

$ npx generate-static-site@latest https://monstermash.zone/ www
$ npx five-server@latest www