Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown option --extractCss in AspNetCore Angular 6.0 SPA Template

I have scaffolded AspNetCore Angular 6.0 SPA template from cli and then installed npm package accordingly.

However when i try to run the project dotnet run it does not start rather prompted with and error. I have captured a screenshot for your reference. I am not sure whether it is something to do with angular.Json file or else!!! Any idea..

Error:

Unknown option --extractCss

Error Captured

like image 639
Urgen Avatar asked May 18 '18 16:05

Urgen


1 Answers

This is because the ng serve command no longer supports --extractCss option

Open package.json. You'll find

{
  "scripts": {
    "start": "ng serve --extract-css" // Please remove the --extract-css
    // ...
  }  
}

remove the --extract-css from start scripts.

It'll be now

{
  "scripts": {
     "start": "ng serve"
      // ...
  }   
}

Now open angular.json. set "extractCss": true in build configuration

example:

"build": {
    "architect": {
           "configurations": {
                "extractCss": true,
                  //...
             }
         }
      }
   }

Reference: https://github.com/angular/angular-cli/issues/10666#issuecomment-386843570

Reference 2: http://www.talkingdotnet.com/upgrade-angular-5-app-angular-6-visual-studio-2017/

like image 59
Ritwick Dey Avatar answered Oct 14 '22 01:10

Ritwick Dey