Unknown option --extractCss in AspNetCore Angular 6.0 SPA Template

别来无恙 提交于 2020-01-02 00:56:08

问题


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.Jsonfile or else!!! Any idea..

Error:

Unknown option --extractCss


回答1:


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/



来源:https://stackoverflow.com/questions/50415679/unknown-option-extractcss-in-aspnetcore-angular-6-0-spa-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!