From 04e1f79f37a7233fbf9fa6326529c8850464c160 Mon Sep 17 00:00:00 2001 From: NeilClack Date: Tue, 29 Sep 2026 13:29:55 -0500 Subject: [PATCH] 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. --- .vscode/DEBUGGING.md | 73 ++++++++++++++++++++++++++ .vscode/launch.json | 116 ++++++++++++++++++++++++++++++++++++++---- .vscode/settings.json | 11 +++- .vscode/tasks.json | 53 ++++++++++++++----- 4 files changed, 229 insertions(+), 24 deletions(-) create mode 100644 .vscode/DEBUGGING.md diff --git a/.vscode/DEBUGGING.md b/.vscode/DEBUGGING.md new file mode 100644 index 0000000..993125b --- /dev/null +++ b/.vscode/DEBUGGING.md @@ -0,0 +1,73 @@ +# Debugging the Portal in VS Code + +Two independent debug targets: **backend** (server-side SvelteKit code) and +**frontend** (client-side Svelte/browser code). Pick from the Run and Debug +panel (⇧⌘D). + +## Backend (server-side code) + +Breakpoints work in `+page.server.ts`, `+server.ts`, `$lib/server/**`, +`hooks.server.ts`, `src/lib/db.ts`, etc. + +1. Run and Debug → **"Backend: Attach to Dev Server"** (or press F5 with it + selected). It starts the dev server (Vite with the Node inspector on + `:9229`) and attaches automatically. +2. Open a server file, click in the gutter to set a breakpoint, then interact + with the app — the breakpoint hits. + +Alternatives: + +- **"Backend: Launch Dev Server"** — VS Code starts Vite itself and debugs it + directly (no separate task). Good if you want to stop/restart cleanly. +- **"Backend: Attach (no server start)"** — attach when the server is already + running with the inspector (used by the Full Stack compound). + +> **Why not `npm run dev`?** `NODE_OPTIONS=--inspect` on `npm` puts the +> inspector on the _npm_ process, not Vite, so your breakpoints never hit. The +> tasks/configs run `./node_modules/.bin/vite` **directly** so the inspector owns +> the process that actually executes the SSR code. + +## Frontend (client-side code) + +Breakpoints work in `.svelte` `