Can't debug nodejs process with source map

My nodejs project is using babel to do the translation from es5 to es7. I am able to generate the source maps files under `lib` directory. I configured the debug as below screen shot. 

 

From above screen shot you can see the parameter I passed to nodejs  is `lib` directory where includes all the generated js code and source maps files. I am able to launch my application and I can see the console log from Intellij. But the breakpoints I added on the source code doesn't work.  My application is running and ignores all breakpoints. The Intellij version I am using is 2017.3. Nodejs plugin version is 173.3727.69. My OS version is Mac OS 10.13.1.

Another question is how to let Intellij to generate the source map automatically? I am currently generating these source maps manaully through shell command. 

 

0
5 comments

please can you share a project that shows up the issue? If you can't provide your actual project, please try composing a small sample with similar configuration

>Another question is how to let Intellij to generate the source map automatically? I am currently generating these source maps manaully through shell command.

you can set up Babel as a file watcher, for example - see https://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-webstorm-transpiling/

0
Avatar
Permanently deleted user

You can clone this project from GitHub: https://github.com/SouthbankSoftware/dbkoda-controller.git.

Run `yarn install` and `yarn dev:build`.

Then you can see all source maps files are generated under `lib` directory. You can debug the app based on the screenshot I posted. And try to add a breakpoint in `src/config.js`. This file will be loaded at the time you launch the application. 

0

Try moving `lib` from Node parameters to JavaScript file: field. With your configuration, node.js is run as `node lib --inspect-brk=57159`, i.e. ` --inspect-brk` is treated as your application argument, not as Node.js parameter, and no debug process is started

0
Avatar
Permanently deleted user

Thanks, put lib in javascript file works and I am able to debug the code. One problem on that is if there is an exception happens and it will link the code to the source map under `lib` directory instead of the real source code. Is there a way to link the code to the real source?

0

Please sign in to leave a comment.