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.

when using <ClientOnly> nuxt3 application fails with the following error: "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec."

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v14.18.2
  • Nuxt Version: 3.0.0-rc.6
  • Package Manager: npm@6.14.15
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

1). Clone the following project: https://github.com/Schetnan/nuxttest 2). Execute the following instructions

npm install npm run build2 ( build using ‘node’ preset ) npm run start:express In browser, go to: http://localhost:8082/fcp/tst

Describe the bug

Application will come up with a blank screen and in the console, the following error:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Additional context

No response

Logs

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
elzodxoncommented, Dec 14, 2022

Hi. I think we can close this issue.

We have added to this code for server configuration.

location ~ \.js {
        add_header Content-Type text/javascript;
    }

Thank you. @misaon

1reaction
misaoncommented, Dec 12, 2022

Its about web server configuration, not Nuxt problem…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expected a JavaScript module script but the server responded ...
"Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type...
Read more >
How To Fix Failed To Load Module Script
js :1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict...
Read more >
Plugins directory - Nuxt
The plugins directory contains your Javascript plugins that you want to run before instantiating the root Vue.js Application.
Read more >
Javascript .mjs extension for module script includes has wrong ...
Using Wrangler (v2) to publish a Nuxt 3 app with server-side rendering ... works and the site HTML loads but it has a...
Read more >
Creating Server-side Rendered Vue.js Apps Using Nuxt.js
When initially loading your website, your browser doesn't receive a complete page to display. Instead, it gets a bunch of pieces and instructions...
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