Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mandelbrot Example errors #17

Open
jeffslofish opened this issue Sep 6, 2020 · 2 comments
Open

Mandelbrot Example errors #17

jeffslofish opened this issue Sep 6, 2020 · 2 comments

Comments

@jeffslofish
Copy link

I am trying to run the Mandelbrot Example locally, and I ran into this error when serving the content with http-server:

(index):1 Uncaught (in promise) TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

I eventually (I believe) found a way to serve the wasm with the correct MIME type using a php server. The documentation I found is here: https://www.php.net/manual/en/features.commandline.webserver.php#example-424. Following this I created a file called router.php with the following contents:

<?php
// router.php
$path = pathinfo($_SERVER["SCRIPT_FILENAME"]);
if ($path["extension"] == "wasm") {
    header("Content-Type: application/wasm");
    readfile($_SERVER["SCRIPT_FILENAME"]);
}
else {
    return FALSE;
}
?>

then I ran php -S localhost:8000 router.php. At this point I ran into a new error:
Uncaught (in promise) TypeError: Cannot read property 'update' of undefined in which the "exports" variable coming from the line }).then(({ exports }) => { is undefined.

Any ideas what is going wrong here?

@dcodeIO
Copy link
Member

dcodeIO commented Sep 6, 2020

Does this also happen when following the very last steps in the example docs using the http-server node module?

npm install --save-dev http-server
http-server . -o -c-1

@jeffslofish
Copy link
Author

Yes, i get the following:

(index):1 Uncaught (in promise) TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

Apparently there is a bug in http-server in that it serves a charset with application/wasm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants