Base solution for your next web application
Open Closed

Style issues on prod (angular project) #7457


User avatar
0
Ricavir created

Hi,

I'm having issues while building my angular app to production. I already read a lot of posts about this issue but I don't think they are related.

While updating my project from angular 6 to 7, I had no issues on development and on production.

Then I updated to angular 8 following aspnetzerocore git history as a guideline. Everything was working in development side and I was quite happy with it.

After building the project for production, I had wired displays and notice some CSS errors like Refused to apply style from 'https://l........../styles.4c76562f84d5dfde9446.css' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I tried a lot of things without any success. found this link interesting : https://github.com/angular/angular-cli/issues/8577 Then I tried to build angular by deactivating extract-css : the result build command line is >>>>> ng build --prod --extract-css

It is now working

Can you please give me some light on this ? I never had to add extract-css option is in the past... Is it a bad practice for production ?


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Does your angular.json content have a similar configuration?

  • User Avatar
    0
    Ricavir created

    @maliming : I just had to change extraCss option to false. The rest is the same as your screenshot

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ricavir

    Did that change the size of bundles ?

    We didn't have this problem on our demo app. This might be related to Angular version. As I remember our demo is published with something Angular 8.0.x.