Skip to content

Instantly share code, notes, and snippets.

@zefanjajobse
Created April 7, 2025 20:09
Show Gist options
  • Save zefanjajobse/66756d31f9017d50d3a57f87e46a7566 to your computer and use it in GitHub Desktop.
Save zefanjajobse/66756d31f9017d50d3a57f87e46a7566 to your computer and use it in GitHub Desktop.
Vite F5 debug for both chrome and firefox with autostart/stop of devserver
{
"version": "0.2.0",
"configurations": [
{
"name": "localhost (Chrome)",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/dist",
},
{
"name": "Debug Web",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
},
"runtimeArgs": [
"--remote-debugging-port=9222"
],
"sourceMaps": true,
"preLaunchTask": "vite: dev",
"postDebugTask": "Terminate All Tasks",
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "vite: dev",
"type": "npm",
"script": "dev",
// Vite dev runs indefinitely in the background
// Since it never exits, VS Code waits indefinitely for it to finish
// This is a workaround to tell VS Code to not wait before launching the next task
"isBackground": true,
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
},
]
},
{
"label": "Terminate All Tasks",
"command": "echo ${input:terminate}",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment