Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng serve --prod --source-map does not produce source maps #10886

Closed
Maximaximum opened this issue May 16, 2018 · 5 comments
Closed

ng serve --prod --source-map does not produce source maps #10886

Maximaximum opened this issue May 16, 2018 · 5 comments

Comments

@Maximaximum
Copy link

Maximaximum commented May 16, 2018

Versions

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.1
Node: 8.9.4
OS: win32 x64
Angular: 6.0.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/flex-layout              5.0.0-beta.13
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • Run ng serve --prod --source-map

Observed behavior

The ouput js and css bundles do not contain the source maps.

Desired behavior

The output bundles should contain the source maps, and the browser (Chrome) should recognize them.

Mention any other details that might be useful (optional)

@jmesa-sistel
Copy link

You can change it in angular.json in architect -> build -> "builder": "@angular-devkit/build-angular:browser" -> configurations -> production -> sourceMap

@Maximaximum
Copy link
Author

Thank you, @jmesa-sistel. Indeed, it works. But:

  1. Nowhere in the documentation could I find any information on this. It would be nice to add explicit documentation.
  2. IMO, since there is a --source-map command-line flag, it should do something 😄 Anyway, it would be nice to have an ability to enable sourcemaps via CLI, without modifying the angular.json file.

@jmesa-sistel
Copy link

@Maximaximum
Docs about new schemas system:
https://github.com/angular/angular-cli/wiki/angular-workspace
To understand how it works I used a json online viewer to understand the organization.
I have to say that this new config system is very powerful, I usually had to eject the configuration, now it is not needed for me.
Seems that the angular.json configuration has precedence over cli parameters, with --prod you select production configuration so --source-map parameter is overwritten , maybe it is a bug, I do not know.

@Maximaximum
Copy link
Author

@jmesa-sistel yeah, it looks like a bug to me, because otherwise I wonder what is the sense of having the command-line args at all, if they're overwritten by the config file.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants