vendorSourceMap deprecated in Angular CLI 7.2
Asked Answered
S

2

19

Starting with Angular 7.2, the vendorSourceMap option is deprecated:

> ng serve --vendor-source-map

Option "vendorSourceMap" is deprecated.

Official documentation of ng serve says vendorSourceMap is deprecated, but gives no alternative way of resolving library sources:

--vendorSourceMap=true|false

Deprecated

Resolve vendor packages sourcemaps.

Default: false

What is the correct, non-deprecated way, then to resolve vendor source maps in Angular 7.2?

Sailcloth answered 15/4, 2019 at 13:38 Comment(1)
According to this, --sourceMap will be used in the future. Looks like they are moving away from the flag being a Boolean to allowing more options. Maybe try something like --sourceMap=vendor(?)Myxoma
B
52

The correct angular.json options are

"serve": {
  "builder": "@angular-devkit/build-angular:dev-server",
  "options": {
    "sourceMap": {
      "scripts": true,
      "styles": true,
      "vendor": true
    },
...

Verified on 10.0.*. (Updated verfied version from 7.2.15 > 10.0.*)

Btw, the documentation is really poor on this matter, and I could not find a blog post or resource with an example.

Boney answered 19/6, 2019 at 14:3 Comment(6)
Not that this explains much, but at least it lists the options... angular.io/guide/…Appalachia
Any idea how to set the sourceMap configuration from the command line --sourceMap= to have scripts be true and vendor be false?Miltonmilty
@ThomasJahncke never tried. Honestly the quicker way is to debug the serve script and see where those options go.Boney
@Boney thank you for your reply. FWIW, I am using ng build --watch instead of serve, but that is a different topic. I wasn't able to get the angular.json config to work with that setup so I thought I would try the command line. How do you debug the serve / build script?Miltonmilty
@ThomasJahncke you need to check if the JSON "build" configuration supports the above settings first. It might not. It's a bit difficult for me to answer because I don't work anymore on Angular (or frontend stuff) since February 2020. I'll check if I still have a project thoBoney
@ThomasJahncke as far as I remember you'll find the NG scripts under the angular NPM libraries, probably angular-devkitBoney
M
0

In version 12 this option is not allowed , so you can debug your library by modifying angular.json : and make verbose option equals to true

"serve": {
          "builder": "@angular-devkit/build-angular:dev-server",

          "configurations": {
            "production": {
              "browserTarget": "testAdmin:build:production"
            },
            "development": {
              "browserTarget": "testAdmin:build:development",
              "verbose": true <--- **modify this // or add this option**
            }
          },
          "defaultConfiguration": "development"
        },
Metempsychosis answered 11/1, 2022 at 16:30 Comment(1)
This does not work for the problem. I tried it in Angular 16.Squamation

© 2022 - 2024 — McMap. All rights reserved.