[solved] V4 pwa production build - mime type error in Chrome

Hi folks,
I have a ionic v4.12 pwa in development and it runs fine in localhost:8100. However when I create a --prod build and run it using live-server I get the error:

Refused to apply style from ‘http://127.0.0.1:8080/styles.e4fba2431885efcfd652.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I noticed in the devtools that the error is pointing to an html file and not css. Being relatively new to this whole ionic/javascript/html/css world I am somewhat puzzled and would appreciate some pointers.

Thank you,
Hilton.

which web server are you using? nginx maybe? I would say, I think, the web server of your server doesn’t serve the css files with the right header, it tells your browser that the css files are html files, something like that. Instead of text/html the files should be delivered with text/css

Thanks for that. I was using live-server (a server for development), I have switched to lite-server and that works fine.

1 Like