'How do I load a rust/wasm/js file onto a webpage?

Currently I have followed all instructions, though I'm getting the following error:

Module loading from 'http://localhost:8000/pkg/testing.js' has been blocked due to a disallowed MIME type ('text/plain')

Currently I have this in my head of the html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

Though the previous:

<html>
  <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
  </head>

Did not work either.

I'm trying to run the code on a python server, in firefox.

How do I fix this issue? I used "wasm-pack build --target web" to create my project.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source