Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting WebAssembly running

I'm trying to get WebAssembly's polyfill-prototype-1 running:

I have a localhost running a .html file with only the basics ( ) and a call to loadWebAssembly() as specified in https://github.com/WebAssembly/polyfill-prototype-1/blob/master/README.md.

However, when I go to the page I get the error: "http://localhost/-username-/polyfill-prototype-1/undefined 404 (Not Found)" because packedURL in load-wasm.js is undefined, which as seen in the afore-cited link, seems to mean that step 2 in "How it (currently) works" (i.e. "The polyfill library starts up a worker containing asm.js code compiled from unpack.cpp concatenated with the glue code in load-wasm-worker.js.") Isn't being called/run/something

I've speculated that I'm not giving it the path to the code to convert or something, but I don't know how to do so.

What am I doing wrong/how do I get it to turn my c++ code into asm.js so it can continue to step 3?

like image 257
jen Avatar asked Aug 21 '15 23:08

jen


1 Answers

Following this article for this GitHub repo running locally in c:\Inetpub\wwwroot\WASM\Index.html, in IIS I converted the directory to an application and get a 404 Not Found for squarer.wasm when browsing to http://localhost/WASM/Index.html

The error is shown in the Browser Developer Tools console:

HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(Fetch)GET - http://localhost/wasm/squarer.wasm

To get rid of the 404 add a new Mime Type for Wasm, it's not currently in IIS 10 (or below).

Click Start > Run > type InetMgr > expand Sites > select the app > Mime Types > Add:

Extension: .wasm (dot wasm)
MIMEType: application/wasm

Ref: https://github.com/webpack/webpack-dev-middleware/issues/229

like image 166
Jeremy Thompson Avatar answered Sep 21 '22 07:09

Jeremy Thompson