Skip to content

Allow source-map-loader to load Angular's source maps #5119

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

Closed
devoto13 opened this issue Mar 1, 2017 · 4 comments
Closed

Allow source-map-loader to load Angular's source maps #5119

devoto13 opened this issue Mar 1, 2017 · 4 comments
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@devoto13
Copy link
Contributor

devoto13 commented Mar 1, 2017

Versions.

@angular/cli: 1.0.0-rc.0
@angular/*: 2.4.8

Repro steps.

  1. Create new CLI project.
  2. Add debugger; to the constructor of AppComponent.
  3. Run ng serve.
  4. Open in browser.
  5. Observe stack trace showing JS frames instead of TS frames for Angular code.

Mention any other details that might be useful.

This is because source-map-loader excludes everything in the node_modules folder. See excerpt from the Webpack config:

{ enforce: 'pre',
  test: /\.js$/,
  loader: 'source-map-loader',
  exclude: [ '/Users/devoto13/Projects/ng-cli/node_modules' ] }

Is it intentional? I can understand that it may be a precaution to prevent breaking application source maps by some nasty dependency with invalid source maps... But since Angular CLI is for the Angular framework and it's always included, I believe CLI can trust at least framework's source maps.

So I'm asking to relieve this restriction to allow people to have debugging/stack traces over TypeScript source of the framework instead of compiler JS. I did a quick experiment by ejecting Webpack config and removing exclude property and browser picked up source maps and provided correct stack traces (at least in this simple case).

Ideally I would prefer to have an option to either disable the behavior of ignoring third-party source maps completely or enable for specific packages only. It's very useful to be able to debug over source code instead of processed code. Especially, when dealing with minified dependencies :)

PS Source maps are not available for 4.0.0 RC at the moment, but they will be fixed eventually. So request still persists.

@filipesilva
Copy link
Contributor

Hm I see how this is useful. If it add it it can't be the default though... Maybe a --vendor-sourcemaps flag.

@filipesilva filipesilva added P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: enhancement feature Issue that requests a new feature labels Mar 14, 2017
@tsabirgaliev
Copy link
Contributor

FWIW source maps shipped with 4.1.0 have embedded sources of transpiled code, but the sources lists paths to original typescript code, that is very unintuitive.

@filipesilva
Copy link
Contributor

Closing in favor of #5477

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

No branches or pull requests

3 participants