Is there a way to debug code in VsCode initiated with Vite?

Go to the debug tab and click “create debug.json”.

Then adapt the url port to use 4000 if you want to use the Vite plugin for VSCode. Or 3000 if you run it with yarn dev, npm run dev or vite from your console.

I also had to adapt the webRoot as I’ve created an app folder which is my root folder.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:4000",
            "webRoot": "${workspaceFolder}/app"
        }
    ]
}

Leave a Comment