Skip to content

[Typescript] Cannot debug projects with ES Modules (works with CommonJS) #1558

@Lap1n

Description

@Lap1n

Debug adapter definition and debug configuration

        dap.adapters["pwa-node"] = {
          type = "server",
          host = "localhost",
          port = "${port}",
          executable = {
            command = js_debug_bin,
            args = { "${port}" },
          },
          options = {
            detached = false,
          },
          enrich_config = function(config, on_config)
            -- Under the hood, always use the main adapter
            config.type = "pwa-node"
            on_config(config)
          end,
        }

Launch.json config:

    {
      "name": "Attach to node Process",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "skipFiles": [
        "<node_internals>/**"
      ],
      "sourceMaps": true
    },

Debug adapter version

v1.104.0

Steps to Reproduce

  1. In a Node ESM TypeScript project where stack frames reference sources as relative paths (e.g., “../src/foo.ts”).
  2. Set breakpoints in a “src/*” file before attaching.
  3. Attach to the running process with the config above, continue to a point that should hit the breakpoint.

Expected Result

  • Breakpoints bind immediately and the editor shows the local workspace file content.

Actual Result

  • Breakpoints works
  • The launch.json config works in VS code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions