microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 282 forks source link

Lack of information about sourceMapPathOverrides #2027

Closed DamienCassou closed 4 months ago

DamienCassou commented 5 months ago

Describe the bug

dapDebugServer.js produces events such as:

{
  "seq": 1484,
  "type": "event",
  "event": "loadedSource",
  "body": {
    "reason": "new",
    "source": {
      "name": "/(rsc)/src/app/page.jsx",
      "path": "/(rsc)/src/app/page.jsx",
      "sourceReference": 1615416030
    }
  }
}

{
  "seq": 1503,
  "type": "event",
  "event": "loadedSource",
  "body": {
    "reason": "new",
    "source": {
      "name": "/home/cassou/myproject/src/app/webpack:/@me/country/src/app/page.jsx",
      "path": "/home/cassou/myproject/src/app/webpack:/@me/country/src/app/page.jsx",
      "sourceReference": 734626073
    }
  }
}

Both events refer to the same file but with different paths, none of them matching anything on my filesystem.

I've tried to use sourceMapPathOverrides to override these paths but nothing I do works. It seems https://github.com/microsoft/vscode-js-debug/issues/1597 is about a similar issue.

It would be nice to have this option better documented.

To Reproduce Steps to reproduce the behavior:

  1. Create a new application with npx create-next-app@latest --use-yarn --javascript --app --src-dir
  2. Try to debug the server-side code with dapDebugServer.js
connor4312 commented 4 months ago

Not sure what launch config you're using, but I added some docs in the linked commit

DamienCassou commented 4 months ago

thank you @connor4312