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?
I am trying to run the Mandelbrot Example locally, and I ran into this error when serving the content with http-server:
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:
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 undefinedin which the "exports" variable coming from the line}).then(({ exports }) => {is undefined.Any ideas what is going wrong here?