Skip to content

angular.json: sourceMap.vendor-option in build has no affect on serve #15064

@lcptrs

Description

@lcptrs

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Kinda, if I use ng serve --vendorSourceMap, I'm getting the source maps. But this flag is deprecated and it seems like the sourceMap.vendor-option of the angular.json is the new way to go.

Description

According to the documentation, the serve section in angular.json overrides build defaults and supplies additional serve defaults.
This seems not to be happening with the following configuration:

...
"build": {
  "sourceMap": { "vendor": true, "scripts": true },
  ...
}

If I'm running ng serve the source maps for my library are missing. If I move this option to the serve section, the source maps are getting transferred to client.
It seems, like the compiled output is the same for build and serve.

🔬 Minimal Reproduction

  1. run ng new my-app
  2. cd to my-app
  3. run ng g library my-lib
  4. Call MyLibComponent in app.component.html: <lib-my-lib></lib-my-lib> and update app.module.ts with the necessary imports.
  5. Set the following option in angular.json
...
"build": {
  "sourceMap": { "vendor": true, "scripts": true },
  ...
}
  1. run ng b my-lib && ng serve

If you now inspect the application within the browsers DevTools you won't find the my-lib.component.ts
If you set the sourceMap option under serve, you'll get the *.ts file.

🌍 Your Environment


Angular CLI: 8.1.1
Node: 10.15.3
OS: win32 x64
Angular: 8.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.801.1
@angular-devkit/build-angular      0.801.1
@angular-devkit/build-ng-packagr   0.801.1
@angular-devkit/build-optimizer    0.801.1
@angular-devkit/build-webpack      0.801.1
@angular-devkit/core               8.1.1
@angular-devkit/schematics         8.1.1
@ngtools/json-schema               1.1.0
@ngtools/webpack                   8.1.1
@schematics/angular                8.1.1
@schematics/update                 0.801.1
ng-packagr                         5.3.0
rxjs                               6.4.0
typescript                         3.4.5
webpack                            4.35.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions