Files
portal/.vscode/launch.json
T
NeilClack 04e1f79f37 chore(vscode): separate backend and frontend debug configs
Backend configs run Vite directly (not via npm run dev) so the Node
inspector owns the process that executes SSR code, with source maps
enabled for .ts server files. Frontend configs launch/attach Chrome.
Adds a Node-inspector dev task, a Full Stack compound, and DEBUGGING.md
documenting the Safari limitation and workflows.
2026-09-29 13:29:55 -05:00

126 lines
4.1 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 started yourself with:
// /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
// --remote-debugging-port=9222 --user-data-dir=/tmp/rw-chrome
// Handy when Chrome is already open with your logged-in session.
"name": "Frontend: Chrome (attach)",
"type": "chrome",
"request": "attach",
"port": 9222,
"url": "http://localhost:5173/*",
"webRoot": "${workspaceFolder}",
"sourceMaps": true,
"sourceMapPathOverrides": {
"vite:///src/*": "${webRoot}/src/*",
"/@fs/*": "*"
}
},
{
// 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
}
]
}