Disable Vite's ANSI output (NO_COLOR/FORCE_COLOR) so the background-task problem matcher's endsPattern reliably matches, fixing the 'Error exists after running preLaunchTask' failure. Add a 'Launch Debuggable Chrome' task (:9222, persistent ~/.chrome-rw-debug profile) and an attach compound so you can debug the frontend in a Chrome you control and stay logged in. Update DEBUGGING.md.
136 lines
4.6 KiB
JSON
136 lines
4.6 KiB
JSON
{
|
|
"version": "0.2.0",
|
|
"configurations": [
|
|
{
|
|
// ── BACKEND (server-side SvelteKit code) ─────────────────────────
|
|
// Recommended. Starts the Vite dev server (with the Node inspector on
|
|
// :9229) and attaches. Set breakpoints in +page.server.ts,
|
|
// +server.ts, $lib/server/**, hooks.server.ts, etc.
|
|
"name": "Backend: Attach to Dev Server",
|
|
"type": "node",
|
|
"request": "attach",
|
|
"port": 9229,
|
|
"cwd": "${workspaceFolder}",
|
|
"preLaunchTask": "Start Dev Server (Node Inspector)",
|
|
"restart": true,
|
|
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
|
"sourceMaps": true,
|
|
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"]
|
|
},
|
|
{
|
|
// Same, but without a preLaunchTask — used by the Full Stack compound
|
|
// so only one dev server is started.
|
|
"name": "Backend: Attach (no server start)",
|
|
"type": "node",
|
|
"request": "attach",
|
|
"port": 9229,
|
|
"cwd": "${workspaceFolder}",
|
|
"restart": true,
|
|
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
|
"sourceMaps": true,
|
|
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"]
|
|
},
|
|
{
|
|
// Starts the server itself (no separate task). Runs Vite directly so
|
|
// the inspector owns the SSR process (running via `npm run dev` puts
|
|
// the inspector on npm instead, and your breakpoints never hit).
|
|
"name": "Backend: Launch Dev Server",
|
|
"type": "node",
|
|
"request": "launch",
|
|
"program": "${workspaceFolder}/node_modules/vite/bin/vite.js",
|
|
"args": ["dev", "--port", "5173", "--strictPort"],
|
|
"cwd": "${workspaceFolder}",
|
|
"console": "integratedTerminal",
|
|
"env": {
|
|
"NODE_OPTIONS": "--enable-source-maps",
|
|
"NODE_EXTRA_CA_CERTS": "./digital-ocean.crt"
|
|
},
|
|
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
|
"sourceMaps": true
|
|
},
|
|
|
|
{
|
|
// ── FRONTEND (client-side Svelte/browser code) ───────────────────
|
|
// Launches Google Chrome wired to the Vite dev server (starts it for
|
|
// you). Set breakpoints in .svelte <script> blocks and $lib/**.
|
|
// Requires Chrome (or another Chromium browser) to be installed.
|
|
"name": "Frontend: Chrome",
|
|
"type": "chrome",
|
|
"request": "launch",
|
|
"preLaunchTask": "Start Dev Server",
|
|
"url": "http://localhost:5173",
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMaps": true,
|
|
"sourceMapPathOverrides": {
|
|
"vite:///src/*": "${webRoot}/src/*",
|
|
"/@fs/*": "*"
|
|
},
|
|
"skipFiles": ["<node_internals>/**"]
|
|
},
|
|
{
|
|
// Chrome only, no dev-server start — used by the Full Stack compound.
|
|
"name": "Frontend: Chrome (no server start)",
|
|
"type": "chrome",
|
|
"request": "launch",
|
|
"url": "http://localhost:5173",
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMaps": true,
|
|
"sourceMapPathOverrides": {
|
|
"vite:///src/*": "${webRoot}/src/*",
|
|
"/@fs/*": "*"
|
|
},
|
|
"skipFiles": ["<node_internals>/**"]
|
|
},
|
|
{
|
|
// Attach to a Chrome you are already using (with your logged-in
|
|
// session). Chrome must have been started with a debugging port.
|
|
// Easiest path: run the "Launch Debuggable Chrome" task once, log in,
|
|
// navigate to http://localhost:5173, then start this profile.
|
|
// It does NOT start the dev server or a browser for you.
|
|
"name": "Frontend: Chrome (attach)",
|
|
"type": "chrome",
|
|
"request": "attach",
|
|
"port": 9222,
|
|
"url": "http://localhost:5173/*",
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMaps": true,
|
|
"sourceMapPathOverrides": {
|
|
"vite:///src/*": "${webRoot}/src/*",
|
|
"/@fs/*": "*"
|
|
},
|
|
"skipFiles": ["<node_internals>/**"]
|
|
},
|
|
{
|
|
// If you specifically want Edge instead of Chrome.
|
|
"name": "Frontend: Edge",
|
|
"type": "msedge",
|
|
"request": "launch",
|
|
"preLaunchTask": "Start Dev Server",
|
|
"url": "http://localhost:5173",
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMaps": true,
|
|
"sourceMapPathOverrides": {
|
|
"vite:///src/*": "${webRoot}/src/*",
|
|
"/@fs/*": "*"
|
|
}
|
|
}
|
|
],
|
|
"compounds": [
|
|
{
|
|
// Backend + frontend together, starting exactly one dev server.
|
|
"name": "Full Stack (Backend + Chrome)",
|
|
"configurations": ["Backend: Attach (no server start)", "Frontend: Chrome (no server start)"],
|
|
"preLaunchTask": "Start Dev Server (Node Inspector)",
|
|
"stopAll": true
|
|
},
|
|
{
|
|
// Start the dev server, then attach to your already-open, logged-in
|
|
// Chrome. Run the "Launch Debuggable Chrome" task once beforehand.
|
|
"name": "Frontend: Attach to my Chrome (starts server)",
|
|
"configurations": ["Frontend: Chrome (attach)"],
|
|
"preLaunchTask": "Start Dev Server",
|
|
"stopAll": true
|
|
}
|
|
]
|
|
}
|