Angular-cli: Allow source-map-loader to load Angular's source maps

Created on 1 Mar 2017  路  4Comments  路  Source: angular/angular-cli

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.

3 (nice to have) feature

Most helpful comment

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

All 4 comments

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

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.

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._

Was this page helpful?
0 / 5 - 0 ratings