andreas-groos
1/1/2019 - 4:14 PM

[node debug] debugging setup for node es6 #vscode #node #debug

[node debug] debugging setup for node es6 #vscode #node #debug

Node ES6 debug setup:

// launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Es6",
      "cwd": "${workspaceFolder}",
      "sourceMaps": true,
      "preLaunchTask": "npm: build",
      "program": "${workspaceFolder}/dist/index",
      "stopOnEntry": false,
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "${workspaceFolder}",
      "outFiles": ["${workspaceFolder}/dist/**"],
      "skipFiles": ["${workspaceFolder}/node_modules/**/*.js"]
    }
  ]
}
// package.json
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon src/index.js --exec babel-node ",
    "build": "rm -rf dist/ && npm run build:src",
    "build:src": "babel src/ --out-dir=dist --source-maps",
    "watch": "npm run build:src --watch"
  },
// .babelrc
{
  "presets": ["env", "stage-0"],
  "plugins": ["transform-runtime"]
}