├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── package.json └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | package-lock.json -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch", 6 | "type": "node", 7 | "request": "launch", 8 | "program": "${workspaceRoot}/server.js", 9 | "stopOnEntry": false, 10 | "args": [], 11 | "cwd": "${workspaceRoot}", 12 | "preLaunchTask": null, 13 | "runtimeExecutable": null, 14 | "runtimeArgs": [ 15 | "--nolazy", 16 | "--require", 17 | "babel-register" 18 | ], 19 | "env": { 20 | "NODE_ENV": "development" 21 | }, 22 | "console": "internalConsole", 23 | "sourceMaps": true, 24 | "outFiles": [] 25 | }, 26 | { 27 | "name": "Attach", 28 | "type": "node", 29 | "request": "attach", 30 | "port": 5858, 31 | "address": "localhost", 32 | "restart": false, 33 | "sourceMaps": false, 34 | "outFiles": [], 35 | "localRoot": "${workspaceRoot}", 36 | "remoteRoot": null 37 | }, 38 | { 39 | "name": "Attach to Process", 40 | "type": "node", 41 | "request": "attach", 42 | "processId": "${command.PickProcess}", 43 | "port": 5858, 44 | "sourceMaps": false, 45 | "outFiles": [] 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Todsaporn Banjerdkit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vscode-debug-nodejs-es6 2 | How to debug ES6 NodeJS with VSCode 3 | 4 | ![screen shot 2016-10-30 at 12 26 21](https://cloud.githubusercontent.com/assets/97060/19834777/617b5240-9ea0-11e6-9b55-9422c8d7a2c0.png) 5 | 6 | # Prerequisites 7 | - VSCode : http://code.visualstudio.com/ 8 | - NodeJS : https://nodejs.org/ 9 | 10 | # Setup 11 | ```shell 12 | $ git clone https://github.com/katopz/vscode-debug-nodejs-es6.git 13 | $ npm i 14 | ``` 15 | 16 | # Debug 17 | - Create breakpoint in VSCode at `server.js` somewhere. 18 | - Press F5 to debug. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-debug-nodejs-es6", 3 | "version": "1.0.0", 4 | "description": "How to debug ES6 NodeJS with VSCode", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/katopz/vscode-debug-nodejs-es6.git" 13 | }, 14 | "author": "katopz", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/katopz/vscode-debug-nodejs-es6/issues" 18 | }, 19 | "homepage": "https://github.com/katopz/vscode-debug-nodejs-es6#readme", 20 | "devDependencies": { 21 | "babel-preset-env": "^1.6.1", 22 | "babel-register": "^6.26.0" 23 | }, 24 | "babel": { 25 | "presets": [ 26 | "env" 27 | ], 28 | "sourceMaps": true, 29 | "retainLines": true 30 | }, 31 | "dependencies": { 32 | "es6-promise": "^4.0.5", 33 | "isomorphic-fetch": "^2.2.1" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | import fetch from 'isomorphic-fetch'; 2 | // Will fetch README 3 | fetch('https://raw.githubusercontent.com/katopz/vscode-debug-nodejs-es6/master/README.md') 4 | .then(function (response) { 5 | // Something wrong. 6 | if (response.status >= 400) { 7 | throw new Error("Bad response from server"); 8 | } 9 | // Parse response to text 10 | return response.text(); 11 | }) 12 | .then(function (responseText) { 13 | // Our README. 14 | console.log(responseText); 15 | }); --------------------------------------------------------------------------------