0

I am trying to set up an extra website in a firebase project.

A first website is already working. The second is meant to become an API that customer sites will be able to query.

This is the index.html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <title>API-PAGE</title>
    <script type="module" src="index.js"></script>
  </head>
  <body>
    <h1>MY-API-PAGE</h1>
  </body>
</html>

The main file for the API is called index.js. But I presume its content is not very relevant for the question.

I am getting this error:

Loading module from “https://example.web.app/index.js” was blocked because of a disallowed MIME type (“text/html”).

What is the kind of mistake, that I may have made, which can lead to this kind of error?

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Michel
  • 10,303
  • 17
  • 82
  • 179
  • The error is caused by the app not being able to find `index.js` due to it not being in the base directory. Add the context route, or use ``. See more [here](https://stackoverflow.com/questions/59925804/blocked-because-of-a-disallowed-mime-type-text-html-angular-8-deployed-on). – Joe Moore Jan 19 '23 at 10:16
  • What is Firebase related issue here? – Dharmaraj Jan 19 '23 at 12:32

1 Answers1

0

This error occurs because index.js is not found where specified (in this case, where is isn't specified).

Add:

<base href=".">

Or alternatively use the context route to reference the JS file.

Joe Moore
  • 2,031
  • 2
  • 8
  • 29