Angular-cli "Unknown option: '--sourceMap' when using '--project'

See original GitHub issue

🐞 Bug report

Command (mark with an x)

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

Description

A clear and concise description of the problem...

ng build --sourceMap --watch works. ng build --project mylib --sourceMap --watch does not work

🔬 Minimal Reproduction

  1. Create an app ng new myapp (yes routing, SASS)
  2. cd to the folder
  3. Create a new library ng generate library my-new-lib
  4. Run ng build --sourceMap, this works (I know this is default behavior, put it on false also works).
  5. Run ng build my-new-lib --sourceMap
  6. Get the error: `Unknown option: ‘–sourceMap’

Also tried all of the similar commands that I know or found on the internet:

--source-map --vendor-source-map --vendorSourceMap

🔥 Exception or Error


 Unknown option: '--sourceMap'

🌍 Your Environment


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

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.8
@angular-devkit/build-angular      0.13.8
@angular-devkit/build-ng-packagr   0.13.8
@angular-devkit/build-optimizer    0.13.8
@angular-devkit/build-webpack      0.13.8
@angular-devkit/core               7.3.8
@angular-devkit/schematics         7.3.8
@angular/cli                       7.3.8
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.8
@schematics/angular                7.3.8
@schematics/update                 0.13.8
ng-packagr                         4.7.1
rxjs                               6.3.3
typescript                         3.2.4
webpack                            4.29.0

Anything else relevant?

A suggested option was to change the angular.json and include "vendorSourceMap" : true within my-new-lib > architect -> build -> options, but that gives the following error:


Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(vendorSourceMap).

Another option is to change the tsconfig.json. But after doing that, I get the error an application startup Cannot Get / (which is btw the best possible error message to debug -.-)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Apr 6, 2019

You need to set a sourceMap property under the build target options of your app in the angular.json

sourceMap: {
        scripts: true,
        styles: true,
        vendor: true
}
0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular CLI "Unknown option: '--sourcemap'" error
I try to enable source maps in my Angular-Sass project with these commands: ng serve -sm -ec ng serve --sourcemap --extract-css ng serve ......
Read more >
ng build - Angular
Option Description Value Type Default Value ‑‑aot Build using Ahead of Time compilation. boolean true ‑‑base‑href Base url for the application being built. string ‑‑delete‑output‑path Delete...
Read more >
Angular CLI - ng build Command - Tutorialspoint
Sr.No. Option & Syntax Description 2 ‑‑baseHref=baseHref Base url for the application being built. 9 ‑‑deployUrl=deployUrl URL where files will be deployed. 17 ‑‑localize=true|false
Read more >
angular/angular-cli - Gitter
anyway I found it, in angular.json, set "options" -> "configurations" -> "sourceMap": true. but I still prefer an option in "ng build" command....
Read more >
Angular CLI 6 Unknown option: '–singleRun' – iTecNote
ng test --source-map=false --single-run --no-progress --browsers=ChromeNoSandbox ... With older versions of angular-cli, you used to be able to use both ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found