vscode-firefox-debug icon indicating copy to clipboard operation
vscode-firefox-debug copied to clipboard

Bug: breakpoints are not hit after rebuilding the project [vite]

Open igorlfs opened this issue 10 months ago • 2 comments

Related #362

After enabling sourcemap for vite (see below), I can consistently hit breakpoints, and their locations will be resolved correctly.

export default defineConfig({
    plugins: [sveltekit()], // svelte specific stuff, your config might be different
    build: {
        sourcemap: true
    }
});

However, once I rebuild the project (via vite dev), breakpoints are no longer hit. No wrong locations, no phantom breakpoints, just not hit at all.

I do wanna stress that rebuilding is something that happens constantly during development, so it should be supported (if possible).

After some investigation, I found out that vite appends a timestamp to the sources (and it also keeps old copies), which can be seen in FF's debugger (screenshot below):

Image

I wonder if it's related?

More info

Launch config:

    {
      "name": "Launch Firefox",
      "type": "firefox",
      "suggestPathMappingWizard": true,
      "reAttach": true,
      "request": "launch",
      "url": "http://localhost:5173/",
      "webRoot": "${workspaceFolder}"
    }

The same issue happens on neovim and vscode, so it's not client-side related.

igorlfs avatar Mar 04 '25 21:03 igorlfs

I also use vite with React. Breakpoints are hit (most of the time). However when rebuilding, sometimes the debugger starts ignoring everything, and I have to restart the debugger (in VSCode CTRL+SHIFT+F5).

Note: I did not configure vite for sourcemap (I do not have this configuration that you mentioned)

export default defineConfig({
...

and I'm using pathMappings with reAttach:true in launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run Front DEV",
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "url": "http://localhost:5110/",
            "log": {
                "consoleLevel": {
                    "PathConversion": "Debug",
                    "default": "Error"
                }
            },
            "pathMappings": [
                {
                    "url": "http://localhost:5110/",
                    "path": "${workspaceFolder}/frontend/"
                }
            ]
        }
    ]
}

Automatically translated.

text in Brazilian Portuguese

Também uso vite com React. Os pontos de interrupção são alcançados (na maioria das vezes). Porem quando reconstruído, às vezes o depurador começa a ignorar tudo, e tenho de reiniciar o depurador (no VSCode CTRL+SHIFT+F5).

Obs. Não configurei o vite para sourcemap (não tenho essa configuração que você citou)

export default defineConfig({
...

e estou utilizando pathMappings com reAttach:true no launch.json :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run Front DEV",
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "url": "http://localhost:5110/",
            "log": {
                "consoleLevel": {
                    "PathConversion": "Debug",
                    "default": "Error"
                }
            },
            "pathMappings": [
                {
                    "url": "http://localhost:5110/",
                    "path": "${workspaceFolder}/frontend/"
                }
            ]
        }
    ]
}

djedu28 avatar Apr 15 '25 02:04 djedu28

Another observation is worth noting. I have the extension installed:https://addons.mozilla.org/pt-BR/firefox/addon/react-devtools/

Automatically translated.

Text in Brazilian Portuguese Vale outra observação. Tenho instalado a extensão: https://addons.mozilla.org/pt-BR/firefox/addon/react-devtools/

djedu28 avatar Apr 15 '25 02:04 djedu28