I am just trying to get my first Compose WASM app ...
# webassembly
m
I am just trying to get my first Compose WASM app running in the browser. The app was generated via the Kotlin Multiplatform Wizard | JetBrains. Running it locally in the browser via
wasmJsBrowserRun
works without problem in Firefox and Chrome (latest versions) but when I create a distribution via
wasmJsBrowserDistribution
and upload it to my own server I just get a white page when I call the corresponding URL. The page seems to load but in the developer tools of the browser I see many lines like this. Does anyone know what the reason for this is and how it can be cured?
Copy code
wasm streaming compile failed: TypeError: WebAssembly: Response has unsupported MIME type '' expected 'application/wasm'
1
K 1
p
Just guess: may be your server doesn't have mapping for wasm file extention to content type. Check in browser network development tools what content type have response for wasm file resource.
m
In the network analysis view files with the extension “wasm” have the type “wasm” too, if that’s what you mean.
p
What value have response header Content-Type
For request for fetching wasm file
m
I am not a web developer and have no idea where to find this information you are looking for. Maybe it is faster if you just look at this URL https://mpmediasoft.de/test/AIPBrowserExp/index.html I’d be happy if you could point me to a solution 😇.
p
I'll on mobile browser now. I'll help you within couple of hours when reach to laptop.
m
Thanks @Robert Jaros. But I doubt that this is the problem. (I don’t access to the server configuration. I can only upload files to it.) I have another, older example running on the same server side by side with the example from above and this works without problem. https://mpmediasoft.de/test/PolySpiralMpp/ It uses Compose Kotlin with JS and not WASM but it contains the file
skiko.wasm
and that works without problem. So, I doubt that the server settings are wrong.
r
In both cases, your server doesn't return the correct content-type header for the
wasm
file. There is even the same message in the browser console. There is a difference - in the older example this is only a warning and in the newer it's an error. Perhaps there is some fallback in the old skiko.js. Anyway, fixing the server configuration is the correct way to address this issue.
1
👆 1
thank you color 1
m
Ok, thanks a lot. I will see how I can get that fixed.
It works now 🎉. I don’t have access to the /etc/mime.types file as suggested in the above article but I can place
Copy code
AddType application/wasm .wasm
in a local
.htaccess
file and voila it works. Thanks a lot to everybody who helped.
🎉 3
thank you color 1
c
awesome. TIL. what server are you using to host?
a
.htaccess typically means Apache server
c
gotcha. i guess i was curious which hosting provider. heroku, etc? idk. im not a web dev, so im just trying to learn where i can deploy my apps.
m
Yes, it seems to be an Apache server. The hosting provider is https://www.ionos.de/
👍 1