Debugging Angular 2 app over 2 projects

I have an Angular 2 library which we publish to NPM. 

On the main app we use the module. relying on npm install ..... 

I want to debug the app but some of the code I need to debug is in the library.  I the options under debugging/stepping in preference to allow node_modules to be debugged but didn't have any success. I have tried to click share in the debug conifg.  I am able to bug but only the main app and never the library. 

There must be a way for me to tell the app about the library project 

0
4 comments

Try specifying Remote URL mappings for your node_modules directory (see https://youtrack.jetbrains.com/issue/WEB-24509#comment=27-1776923) - does it help?

0

Note: to see what mappings should look like, try inspecting the generated sourcemaps in browser. For example, try opening http://localhost:4200/vendor.bundle.js.map, search for the file you'd like to create breakpoints in there, see what its path in sourcemap looks like

0

Humm didn't work. I guess I want both of these cases to work but right now neither does 

1. I want to debug the library Meaning I want to put a break point on the library project.  This library is published to NPM and my app uses it as a node_module NPM install etc... It's my code though so I have the library 

2. I want to drop a breakpoint in the app project on the .js file in node_modules. 

 

0

1. don't understand, sorry. Would you like to put breakpoints in files located in project A while debugging project B? I don't think it's possible

2. creating breakpoints in files located in node_modules folder of your current project should work, but, if the library files are pre-processed before being executed (bundled with webpack, etc.), you need to make sure that proper sourcemaps are generated and (probably) provide remote URL mappings

0

Please sign in to leave a comment.