lauragift21 / staff-directory

an intuitive resource hub designed to showcase the teams within an organization.
https://staff-directory-4to.pages.dev/
25 stars 11 forks source link

breakpoint debugging with VSCode #3

Open wallabyway opened 5 months ago

wallabyway commented 5 months ago

I cannot debug locally with this example.

The example runs locally in a browser correctly. I set break points, but none are active, and the Hono server code does not hit a breakpoint.

Specifically: In the vscode terminal, I do ...

  1. rpm run preview
  2. VSCode debug tab, I click 'play' (wrangler)
  3. The service attaches correctly
  4. I set break points in app/server.ts, db.ts, but none are active and none are ever hit.

No breakpoints can be hit, yet VSCode debugger has attached.

Also, when I click 'd' to open DevTools, nothing happens.

I'm not clear on what I'm doing wrong with my setup, but I suspect it has something to do with 'preview' command, being pages.

My package.json is
  "scripts": {
    "dev": "vite",
    "build": "vite build --mode client && vite build",
    "preview": "wrangler pages dev ./dist --compatibility-date=2024-03-13",
    "deploy": "npm run build && wrangler pages deploy ./dist"
  },

My launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Wrangler",
            "type": "node",
            "request": "attach",
            "port": 9229,
            "cwd": "/",
            "resolveSourceMapLocations": null,
            "attachExistingChildren": false,
            "autoAttachChildProcesses": false,
            "sourceMaps": true // works with or without this line
          }
    ]
}

and the logs show


npm run preview

> preview
> wrangler pages dev ./dist --compatibility-date=2024-03-13

✨ Compiled Worker successfully
 ⛅️ wrangler 3.52.0
-------------------
Your worker has access to the following bindings:
- D1 Databases:
  - DB: STAFFDB1 (removed)
- R2 Buckets:
  - MY_BUCKET: staffbucket1
⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8788
GET   /
GET   /employee/:id
POST  /admin/create
GET   /admin
GET   /*
╭───────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit