visual-studio-codevscode-debugger

VS Code "Launch Chrome" debug window hanging against "yarn dev" but not "yarn start" after VS Code upgrade 1.95.2


Note: Apparently related to this problem in VS Code 1.95, "Could not read source map": https://stackoverflow.com/a/79138794/1005607

This morning I installed the VS Code version 1.95.2, which may or may not be related to the issue below:

Before, I used to invoke > Launch Chrome (workspace) in VS Code to open debug windows against yarn dev on localhost:3000 and everything used to work fine. My usual configuration is below, and everything was OK. The debug window would connect to localhost:3000 and the app would start.

{
    "folders": [
        {
            "path": "../../../../../../../git/app/Source/client"
        }
    ],
    "settings": {},
    "launch": {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch Chrome",
                "request": "launch",
                "type": "chrome",
                "url": "http://localhost:3000",
                "webRoot": "${workspaceFolder}"
            }

        ]
    }
}

Today, when I Launch Chrome (workspace), the window opens to localhost:3000, and hangs there. The application does not start in the debug window. The application starts OK in a regular, non-VS Chrome, so it is working normally, so this is a VS Code Launch Chrome issue of some kind.

However when I switch to yarn start the VS Code Launch Chrome starts working as before. I get the same behavior as previously with yarn dev. But I don't want to use yarn start because it doesn't have the automatic refreshing for React development, and also my breakpoints don't work.

NOTE: There is this error on the console, not sure if it's significant:

Could not read source map for file:///C:/git/app/Source/client/node_modules/next/dist/compiled/%40next/react-refresh-utils/dist/runtime.js: ENOENT: no such file or directory, open 'c:\git\app\Source\client\node_modules\next\dist\compiled@next\react-refresh-utils\dist\runtime.js.map'


Solution

  • Apparently this is due to upgrading Visual Studio Code to version 1.95. The only solution I have found is to downgrade to version 1.94.2. Check the version you have and while they fix it, disable automatic updates and install version 1.94.2 over the current one. You can download it from https://vscode.download.prss.microsoft.com/dbazure/download/stable/384ff7382de624fb94dbaf6da11977bba1ecd427/VSCodeUserSetup-x64-1.94.2.exe