How to enable CSS sourcemaps for Angular 6 application?

若如初见. 提交于 2019-12-03 00:25:26

From https://github.com/angular/angular-cli/issues/9099#issuecomment-388710635

1) modify angular.json to add --extract-css, in 6.0 this argument is removed from ng serve

 "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
       ---
      },
      "configurations": {
        "production": {
          ---
        },
        "serve": {
          "extractCss": true,
           ---
        }
      }
    },

2) Then change serve->options->browserTarget->project-name:build to project-name:build:serve

"serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "open": true,
        "browserTarget": "<project-name>:build:serve"
      },
      "configurations": {
        "production": {
          ---
        }
      }
    }

3) run ng serve --source-map

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