stackblitz / core

Online IDE powered by Visual Studio Code ⚡️
https://stackblitz.com
MIT License
10.23k stars 888 forks source link

MIME type ('text/html') is not executable, angular 5 #246

Open moorthi07 opened 6 years ago

moorthi07 commented 6 years ago

loader.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

angular 5

EricSimons commented 6 years ago

Can you link the project URL for this?

chambleton commented 6 years ago

hi - i'm having the same issue. Here's a sample (open the chrome debugger console and relaunch stackblitz sample): https://stackblitz.com/edit/react-jserror?file=index.html. There should be 2 console msgs displayed, but it's refusing to run the one from test.js

kattunga commented 6 years ago

I have the same problem trying to code a simple Phaser demo. Any idea?

seveves commented 6 years ago

what's your use-case here? Because you could import 'test.js' to your index.js and the code will be executed. Using external scripts is so 2000 😸 ... bundle everything 😃

kattunga commented 6 years ago

I don't understand, I make the demo again to show you the error and now it works.

ghost commented 6 years ago

i have the same problem Refused to execute script from 'https://js-tjbyv4.stackblitz.io/index.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.. https://js-tjbyv4.stackblitz.io

seveves commented 6 years ago

@a1nb0 your example project is not running because it's missing index.js ... can you link me to the one you have problems with so I may help to fix it :)

ghost commented 6 years ago

@seveves thanks for your reply, well i had a script.js that was linked in the index.html <script src="script.js"></script> and still it did not worked. Why do i need a index.js? Now i renamed script .js to index.js edited index.html too and still the same problem. What am i doing wrong? Thank you LE: added two print screens screen shot 2018-03-30 at 9 20 58 am screen shot 2018-03-30 at 9 22 48 am

seveves commented 6 years ago

look here: https://stackblitz.com/edit/js-1sdwd6?file=index.js no need to add index.js with a <script>tag at all. Works fine for me. How about you?

mohibrahimm commented 6 years ago

I have the same problem project URL https://martmax.co/, Any idea? image

seveves commented 6 years ago

@mohibrahimm this is really not related to stackblitz. That is an issue with some app service or proxy or whatever.

ashutoshkushawaha commented 6 years ago

I have same problem like, Refused to execute script from 'http://localhost:4200/assets/nepalidatepicker.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. please give me a solution.

Hang2016 commented 6 years ago

I solved this error by changing <base href="./"> to <base href="/">in index.html

carloslfu commented 6 years ago

Same issue when using a worker. Example: https://stackblitz.com/edit/js-sx3kxa?file=index.js Error Message: "Refused to execute script from 'https://js-sx3kxa.stackblitz.io/worker.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."

andbul commented 6 years ago

I have the same issue when tried to do ?callback=foo to function in index.js.

kumarbitthal commented 5 years ago

I solved this error by changing <base href="./"> to <base href="/">in index.html

Thanks, it worked for me too.

tkallim commented 5 years ago

Is this solved? I still have MIME type error after adding in index.html

develax commented 5 years ago

Is this solved? I still have MIME type error after adding in index.html

No. https://github.com/stackblitz/core/issues/447

runette commented 4 years ago

I was working on sample that was working and then just stopped working with this error. Has anybody worked out what is causing it because I am having difficulty working out what I can have changed that caused this - especially since as far as I can work out the error starts after the scripts are executed!

nehaGI commented 1 year ago

I'm having the same issue , getting "Refused to execute script from 'https://angularq8s8yh-20ke--4200.local-credentialless.webcontainer.io/tooltip.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."

this is the project link https://stackblitz.com/edit/angular-q8s8yh?file=src/index.html

Steps to reproduce the issue -create a .js file in angular project. -add a script tag like inside index.html file -start the server -see the console where gets the error

GET https://angularq8s8yh-20ke--4200.local-credentialless.webcontainer.io/tooltip.js net::ERR_ABORTED 404 (Not Found) angularq8s8yh-20ke--4200.local-credentialless.webcontainer.io/:1 Refused to execute script from 'https://angularq8s8yh-20ke--4200.local-credentialless.webcontainer.io/tooltip.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

image

PS. Same issue us coming for typecript and javacript project on stackblitz as well. https://stackblitz.com/edit/js-hbjmrm?file=index.html,tooltip.js,index.js

dhrn commented 10 months ago

yes facing the similar issue, but different case :). Im trying to create a service worker with static html template

https://stackblitz.com/edit/js-ziqheq?file=index.html

kamranayub commented 10 months ago

Same issue; but the problem is really that the .js file is returning an HTML page, not the actual file contents. In fact, it seems like any requests just return the generatedindex.html. My guess is that packed files get put onto a separate URL/path. 🤔

image

My assumption was we could just link to local CSS/JS files without a problem. The use case for us is that we need a custom .js file available globally that we provide via the embedded SDK. It can't be part of the module (i.e. can't be import'd), it's a global script that should be on the page. Clarification: Actually, it could be imported but for some reason causes the "infinite loading" issue where the dev server never boots up. So figured I could include it on the page instead.