question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

static site ... loading js files no mime type

See original GitHub issue

hi, i’m getting this error when trying to host static site

the index.html is loading fine then when trying to load the js files (app) i get:

Loading module from “http://localhost:8000/modules/my-element.js” was blocked because of a disallowed MIME type (“”).

my assumption was oak would set the mime type based on extension. if im right is this a bug?

if im wrong is there any documentation that shows an example of the right way to set the the mime type for all served “.js” files?

thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
closet6commented, Jun 11, 2020

thanks, im just sending something now because i haven’t abandoned this, but i’ve been traveling. I’ll be trying to rework this this weekend.

1reaction
closet6commented, Jun 2, 2020

here is the code im using:

  .get("/", async (context) => {
    context.cookies.set(
      "lastVisit",
      new Date().toISOString(),
      { httpOnly: true, sameSite: "strict" },
    );
    await send(context, context.request.url.pathname, {
      root: `/app/web`,
      index: "index.html",
    });
  });

here is the html file script loads



  <script type="module" src="../modules/web.js"></script>
  <script type="module" src="../modules/header.js"></script>
  <script type="module" src="../modules/footer.js"></script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are browsers refusing to load my .js files and complaining ...
This can cause HTML web pages to be downloaded instead of being rendered when they are served with a MIME type other than...
Read more >
Properly configuring server MIME types - MDN Web Docs
How to check the MIME type of received content · Load the file and go to Tools > Page Info to get the...
Read more >
Static files in ASP.NET Core | Microsoft Learn
Learn how to serve and secure static files and configure static file hosting middleware behaviors in an ASP.NET Core web app.
Read more >
Refused to execute script | static resource | because its MIME ...
1. Deploy a static resoure including a js file with incorrect MIME type, for example text/plain · 2. Include file in site VF...
Read more >
Why is “strict MIME type checking” blocking the static serving ...
We just finished a Vue frontend app for a Node.js application. Let's dispatch it to the server and make it public! Let's make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found