Last active
April 30, 2025 15:28
-
-
Save zefanjajobse/6c3764c073830c73853052ce045a6548 to your computer and use it in GitHub Desktop.
Nextjs F5 debug for both chrome and firefox with autostart/stop of devserver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Next.js: debug server-side", | |
| "type": "node-terminal", | |
| "request": "launch", | |
| "command": "npm run dev" | |
| }, | |
| { | |
| "name": "Next.js: debug client-side", | |
| "type": "chrome", | |
| "request": "launch", | |
| "url": "http://localhost:3000", | |
| "preLaunchTask": "next: dev-debug", | |
| "postDebugTask": "Terminate All Tasks", | |
| }, | |
| { | |
| "name": "Next.js: debug client-side (Firefox)", | |
| "type": "firefox", | |
| "request": "launch", | |
| "url": "http://localhost:3000", | |
| "reAttach": true, | |
| "pathMappings": [ | |
| { | |
| "url": "webpack://_N_E", | |
| "path": "${workspaceFolder}" | |
| } | |
| ], | |
| "preLaunchTask": "next: dev-debug", | |
| "postDebugTask": "Terminate All Tasks", | |
| }, | |
| { | |
| "name": "Next.js: debug full stack", | |
| "type": "node", | |
| "request": "launch", | |
| "program": "${workspaceFolder}/node_modules/next/dist/bin/next", | |
| "runtimeArgs": [ | |
| "--inspect" | |
| ], | |
| "skipFiles": [ | |
| "<node_internals>/**" | |
| ], | |
| "serverReadyAction": { | |
| "action": "debugWithEdge", | |
| "killOnServerStop": true, | |
| "pattern": "- Local:.+(https?://.+)", | |
| "uriFormat": "%s", | |
| "webRoot": "${workspaceFolder}" | |
| } | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "2.0.0", | |
| "tasks": [ | |
| { | |
| "label": "next: dev-debug", | |
| "type": "npm", | |
| "script": "dev-debug", | |
| // 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