Home > front end >  Setting up an extra website in a firebase project
Setting up an extra website in a firebase project

Time:01-20

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?

CodePudding user response:

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.

  • Related