Debugging with VSCode

  1. In VSCode, install Duktape Debugger extension.

  2. Create a WhaleJS project as described in Getting started.

  3. Open your project folder in VSCode.

  4. Create “Duktape JS” debug configuration. Make sure you select debug port 26972.

    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Attach (duk)",
          "type": "duk",
          "request": "attach",
          "address": "localhost",
          "port": 26972,
          "localRoots": [
            "${workspaceRoot}"
          ],
          "sourceMaps": false,
          "outDir": null,
          "stopOnEntry": true,
          "debugLog": false
        }
      ]
    }
    
  5. Run your project with whalejs-dbg.

    $ whalejs-dbg [path to project directory]
    

    It will start the project in debug mode, and wait for debugger to attach.

  6. In VSCode, run your Duktape JS debug session. Debugger will attach to already running whalejs-dbg process.

    Now you should be able to put breakpoints and step through your code in VSCode debugger.