denoland / denoland/wasmbuild_example
Disallowed MIME type error when testing in browser
- Dominant language
- JavaScript
- Stars
- 39
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for putting this example together.
**Describe the bug**
Running the example creates browser errors. Generated script tries to load wasmbuild package TypeScript files.
**To Reproduce**
I clone the repo and follow instructions in README. Instead of expected result in the browser console, I see errors from trying to load TypeScript files included in the generated wasm script:
```
Loading module from “https://deno.land/x/wasmbuild@0.15.0/cache.ts” was blocked because of a disallowed MIME type (“application/typescript”).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://deno.land/x/wasmbuild@0.15.0/cache.ts. (Reason: CORS request did not succeed). Status code: (null).
```
Similar issues seen in Chrome and Firefox.
**Expected behaviour**
Expect `3` to be printed to the browser console.
**Additional context**
Errors come from attempting to load TypeScript in these two lines in generated WASM (`lib/rs_lib.generated.js`):
```javascript
import { Loader } from "https://deno.land/x/wasmbuild@0.15.0/loader.ts";
import { cacheToLocalDir } from "https://deno.land/x/wasmbuild@0.15.0/cache.ts";
```
I see the same issue in wasmbuild versions 0.12 to 0.15, though version 0.11.0 outputs the expected result.
Is there a way to generate browser compatible code, with the latest wasmbuild versions?
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.