When my app initially loads all is ok and in Chrome, console errors are 0. When I press the browser refresh, I receive the following error:
Refused to execute script from 'http://localhost:50001/dist/vendor-es5.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I also receive the same error for 'main-es5.js'
The error is generated from my index.cshtml file in here I have:
@section scripts {
<script src="~/dist/vendor-es5.js" asp-append-version="true"></script>
<script src="~/dist/main-es5.js" asp-append-version="true"></script>
}
changing the
<script type="text/javascript" src="~/dist/vendor-es5.js" asp-append-version="true"></script>
still gives the same error.
my index.cshtml file resides in views/home the dist directory resides in clientapp
if I change the reference on the script src to be ./clientapp/dist/vendor-es5.js for instance, then the app still loads correctly first time in, but then when I press the refresh, I get no console errors, but the page still doesn't refresh. Anybody have any ideas where I should go next.
When my app initially loads all is ok and in Chrome, console errors are 0. When I press the browser refresh, I receive the following error:
Refused to execute script from 'http://localhost:50001/dist/vendor-es5.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I also receive the same error for 'main-es5.js'
The error is generated from my index.cshtml file in here I have:
@section scripts {
<script src="~/dist/vendor-es5.js" asp-append-version="true"></script>
<script src="~/dist/main-es5.js" asp-append-version="true"></script>
}
changing the
<script type="text/javascript" src="~/dist/vendor-es5.js" asp-append-version="true"></script>
still gives the same error.
my index.cshtml file resides in views/home the dist directory resides in clientapp
if I change the reference on the script src to be ./clientapp/dist/vendor-es5.js for instance, then the app still loads correctly first time in, but then when I press the refresh, I get no console errors, but the page still doesn't refresh. Anybody have any ideas where I should go next.
~/dist/vendor-es5.js
– IAfanasov
Commented
May 22, 2020 at 9:36
script
? That's not a valid mime type
– Liam
Commented
May 22, 2020 at 11:00
First, please ensure that we have enabled the below HTTP
feature, which makes IIS can properly process requests for static files.
It may also have something to do with the setup of your client’s build tool, for example Webpack
.
Refused to execute script from because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled
In addition, in certain ReactJs applications, the usage of App.use
method also might be a reason for this type of issue.
app.use(express.static(__dirname + "/static"));
Please refer to the below links.
loading a bundle.js file from webpack changes mime type to text/html
Refused to execute script from because its MIME type (...) and strict MIME type (...)
Refused to execute script from because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled
Refused to execute script, strict MIME type checking is enabled?