Skip to content

Instantly share code, notes, and snippets.

@abhisekp
Last active October 7, 2017 05:40
Show Gist options
  • Save abhisekp/0873d38ee69fe2a6bf78d77bf7b69083 to your computer and use it in GitHub Desktop.
Save abhisekp/0873d38ee69fe2a6bf78d77bf7b69083 to your computer and use it in GitHub Desktop.
Debug Node Apps

Debug Node Apps when using babel

In package.json file, add the following script

  "scripts": {
    "start": "node .",
    "build": "babel -D -d build/ src/",
+   "debug": "babel-node --inspect --inspect-brk src/"
  },
$ npm run debug
# yarn run debug

vscode launch.json file

{
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch via NPM",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run-script",
        "debug"
      ],
      "port": 9229
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment