Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a gulp task with VSCode

Tags:

I need to debug a command gulp start with VScode (I got some mapping error with babel during transpilation that I don't understand yet...). The VSCode debug default configuration aims to launch node app.js. How to modify it to trigger the gulp command?

Here is the default configuration. If anyone has hint of how can I do that, I'll be in your debt :)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Lancer",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/app.js",
            "stopOnEntry": false,
            "args": [],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "externalConsole": false,
            "sourceMaps": false,
            "outDir": null
        },
        {
            "name": "Attacher",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "address": "localhost",
            "restart": false,
            "sourceMaps": false,
            "outDir": null,
            "localRoot": "${workspaceRoot}",
            "remoteRoot": null
        }
    ]
}
like image 456
Damien Leroux Avatar asked May 27 '16 07:05

Damien Leroux


People also ask

How do I debug gulp task in Visual Studio Code?

Show activity on this post. In your "Lancer" configuration, make the following changes. Set a breakpoint in the task you want to debug and launch the debugger. Change 'start' to the desired task name to debug other tasks.

How do you debug code in VS code?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

How can I see debug logs in VS code?

You can find other debug logs you've downloaded with Visual Studio Code in the . sfdx/tools/debug/logs folder. Right-click any line in the debug log, then choose SFDX: Launch Apex Replay Debugger with Current File.


1 Answers

In your "Lancer" configuration, make the following changes.

  • Change program to "${workspaceRoot}/node_modules/gulp/bin/gulp.js"
  • Change args to ["start"]

Set a breakpoint in the task you want to debug and launch the debugger. Change 'start' to the desired task name to debug other tasks.

like image 112
Steve Johnson Avatar answered Sep 27 '22 21:09

Steve Johnson