I was wondering if is it possible to debug a javascript hook in Cordova?
My hook is triggered before prepare. My command is
cordova prepare ios
I currently use Visual Studio Code and there is a plugin "Cordova tools" to debug an app at runtime. But my need is to debug at build time.
Any recommandation?
PS : what I mean with debug is real debug, that is to say with breakpoints and display of variables, etc..
Updated answer 25 Nov 2019
Since node-inspector is deprecated, here is how I would now do this:
chrome://inspect in Chrome browsernode --inspect --inspect-brk /path/to/node_modules/cordova/bin/cordova prepare from the root of my Cordova app project which contains the hook scripts I wish to debuginspect on the target to open Chrome Dev ToolsAdd folder to workspace and select the directory inside my Cordova project containing the hook scriptsOriginal answer 7 Jun 2017 Here's how I debug my hook scripts:
npm install -g node-inspectorFrom the Cordova project root directory, run the Cordova command via node inspector with appropriate options to trigger my hook script, for example:
node-debug /path/to/node_modules/cordova/bin/cordova prepare
When node inspector opens in a Chrome tab, browse Sources to find your hook script

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With