Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled in Angular
When Angular bundles your application for serving, it does not know, that it needs to include your css file (and it probably falls back to index.html, when it cannot find the file in the path indicated - that's the error with the incorrect MIME type, because index.html does not have the correct type for a stylesheet).
Try to add the path to the css file in angular.json - in the styles section (projects -> $project name$ -> architect -> build -> options -> styles).
Stylesheet not loaded because of MIME-type Angular application
Looks like the href is wrong.
There is a good answer to a different question exactly like yours:
The usual reason for this error message is that when the browser tries to load that resource, the server returns an HTML page instead, for example if your router catches unknown paths and displays a default page without a 404 error. Of course that means the path does not return the expected CSS file / image / icon / whatever...
The solution is to find the correct path and router configuration so that you get your plain CSS file / image / etc. when accessing that path.
In your case it's the css href.
Exported Angular library gives Refused to apply style because its MIME type error on css font import
I just found out that the problem was caused by the missing aot compilation option, by setting "aot": true
in the angular.json file under the development configuration the css is downloaded as expected.
As in production mode the aot
property is true by default this is an acceptable solution for me.
Mime type error when Importing CSS in Stackblitz
The error is in your html. The href
tag is inside your path.
Change the link to :
<link href="node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
rel="stylesheet"
type="text/css">
Related Topics
CSS 3 Column Liquid Layout Dynamic Same Height Column
CSS Animated Circles - Stop Center Content from Rotating
Common Mistakes for CSS-Designers to Avoid
CSS "Fixed" Child Element Positions Relative to Parent Element Not to the Viewport, Why
CSS Changes on MVC App Not Working
Angular 2 Material and Flex-Layout Alignment
Css: Before/After Content with Title
Consistently Sizing a <Textarea> Under Ie, Ff, Safari/Chrome
How to Get Multiple Borders with Rounded Corners? CSS
How to Use CSS Custom Properties in Values for the Content Property
Right Aligned Bootstrap Container Which Also Aligns with Default Container
CSS Rgba Transparency Bug in Chrome
Bootstrap 4 Right Column on Top on Mobile View
Alternative to Page-Break-Inside:Avoid Because of Compatibility Issues
Font Weight with Google Fonts Roboto, Normal (400) and Bold (700) Work, Light (300) Does Not