vscode debug ES6 application

后端 未结 9 731
小鲜肉
小鲜肉 2020-12-24 02:44

I have VSCode 0.5.0. I set the compilerOptions flag to \"ES6\" and the editor started recognizing my ES6 code as correct. I have babel installed. My Mocha tests use the bab

9条回答
  •  旧巷少年郎
    2020-12-24 03:11

    babel + nodemon

    In the VS Code Terminal, launch your server with the --inspect argument:

    nodemon --inspect --watch src --exec node_modules/.bin/babel-node --presets react,es2015 src/server.js
    

    Among the other lines, one will show the port on which the debugger is listening:

    ...
    Debugger listening on port 9229
    ...
    

    Create the following debug configuration:

    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Port",
        "address": "localhost",
        "port": 9229
    }
    

    Launch the debugger, and if everything went fine you will see in the output Terminal:

    Debugger attached.
    

    From now on, you can debug your application.

提交回复
热议问题