firefox-devtools / vscode-firefox-debug

VS Code Debug Adapter for Firefox
https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug
MIT License
390 stars 63 forks source link

Extension doesn't receive webpack URLs #271

Closed layday closed 2 years ago

layday commented 2 years ago

Thanks for this extension. I've tried using it with an Angular app compiled with Webpack. All of my hosts appear under "loaded scripts" apart from Webpack's. My configuration is:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch localhost",
      "type": "firefox",
      "firefoxExecutable": "C:/Users/[...]/scoop/apps/firefox-developer/95.0b12/firefox.exe",
      "request": "launch",
      "reAttach": true,
      "url": "http://localhost:4200/",
      "webRoot": "${workspaceFolder}",
      "pathMappings": [
        {
          "url": "webpack:///",
          "path": "${webRoot}"
        }
      ],
      "log": {
        "fileName": "${workspaceFolder}/vscode-firefox-debug.log",
        "fileLevel": {
          "default": "Debug"
        },
        "consoleLevel": {
          "SourceMappingThreadActorProxy": "Debug",
          "default": "Warn"
        }
      }
    }
  ],
}

Debug view in Firefox:

ff

Loaded scripts in Code:

vscode

The extension is also unable to map Angular modules using the path wizard. Looking at the log, it does not appear to receive Webpack URLs from Firefox at all (!), so there's nothing for it to map. Would you know why that might be happening?

MetricMike commented 2 years ago

I'm running into this issue as well, but couldn't see anything that jumped out when running with log at debug. Happy to help troubleshoot, but could use some help getting pointed in the right direction. Chrome/Edge work-out-of-the-box, but like layday mentioned, Firefox doesn't appear to be sending Webpack URLs at all for the vscode debugger to map.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "name": "Launch localhost",
            "url": "http://localhost/index.html",
            "webRoot": "${workspaceFolder}"
        },
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"
        }
    ]
}
layday commented 2 years ago

This appears to have been an issue with Webpack on Node 17 where requests for source maps were refused by the server. Starting ng serve with --host=127.0.0.1 fixed it for me. It would be helpful if the extension reported failing requests.

layday commented 2 years ago

Thanks again for the debugger extension - I'll close this since it isn't an issue with the extension.