It appears that the latest angular2 npm package does not provide a way to debug TypeScript sources. Previous solutions on Stack Overflow and Medium are outdated. I have raised an issue on GitHub, please show your support.
There are two main problems:
1) The TypeScript sources no longer point to the correct location in the npm. Instead, they reference a non-existent location within the Angular GitHub sources:
{
"version":3,
"file":"application_ref.js",
"sourceRoot":"",
"sources":["../../../../modules/@angular/core/src/application_ref.ts"] <-------
}
Although this path is irrelevant due to the usage of --inlineSources during compilation of Angular sources, the second problem persists.
2) When attempting to copy the 'modules' folder from the GitHub sources, another issue arises. The JavaScript files in the npm package are compiled into ES6 module syntax, which is not yet supported in browsers. A loader like SystemJS requires Traceur for compatibility. For instance, 'common/index.j' contains:
export { NgLocalization, CommonModule, NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, VERSION, Version, PlatformLocation, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location } from './src/common';
Unfortunately, using Traceur might disrupt existing source maps created for JavaScript files transpiled by Typescript compiler (tsc) so it's not a viable solution.