debugging into angular 2 typescript source code

随声附和 提交于 2019-12-24 08:36:12

问题


I have an angular2 project generated by angular-cli. I want to be able to debug the angular2 typescript source code in chrome dev tools (not my own typescript code but the actual angular2 code). The angular2 npm package under node_modules only contains the transpiled javascript files but they contain source mappings. How can I make this work? Thx.


回答1:


How about putting debugger; at the location you want to debug, this will trigger a breakpoint in chrome dev tools and you can work your way from there.




回答2:


Open chrome developer tool (F12).

Go to Source tab. Enter ctrl+p.

Search the file name in the drop-down.

Select the file and add break point at the line which you want to debug.

And proceed your actions which calls the line which you want to debug.




回答3:


Apparently, this is not yet possible in angular-cli since they ignore source maps in node_modules (https://github.com/angular/angular-cli/issues/1838).



来源:https://stackoverflow.com/questions/40437909/debugging-into-angular-2-typescript-source-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!