Is it possible to debug code that's been generated by eval()?
I love the webstorm! Using 2016.1 for Node.js.
I have code snippets extracted from a database that gets eval'd and then executed. I know, I know, everywhere I turn other developers slap my hand and tell me me how awful it is use eval. Commentary on that evil practice aside, is there any way to debug code that's been eval'd? Would be very helpful! Thanks.
Please sign in to leave a comment.
there is currently no way to debug generated code that has no file associated with it and it lives in V8 VM only. Please follow https://youtrack.jetbrains.com/issue/WEB-7420 for updates
I can suggest trying Node Inspector for this - seems it can debug generated code (see https://github.com/node-inspector/node-inspector/issues/171)
Thank you for the suggestion Elena. Turns out that the code is extracted from MongoDb, and is therefore not present in a file to allow the technique of using <code>node --debug-brk --file_name</code>.
Does Jetbrains have any plans to add the feature to be able to debug dynamically generated code without having the code resident in an file?
Thanks again for getting back to me!
Greg
yes - please vote for ticket mentioned above (https://youtrack.jetbrains.com/issue/WEB-7420 ). Not sure when this feature can be expected though...
Thanks again. Just gave it the big thumbs up.
I'm cheering for you Vladimir Krivosheev!
:-)
I love the new capability! Code is uploaded from a mongodb instance and therefore is executed with javascript 'eval'. Works Great!!! Thanks Vladimir!
Any update or workaround for this? Debugging code executed in eval works fine with visual studio code, but I would prefer doing it in webstorm.
in vscode console.log expressions have a link to a file like <eval>/VM1234565:234 and I can just jump there and add breakpoints.