Skip to content

swc-node cannot triggered breakpoints correctly.  #697

Description

@hua03

This is my demo swc-node-debug-demo.

I used two ways to start the debugger, launch and attach. These ways is useless in Webstorm and VSCode.

There are two ways to set breakpoint, click on editor gutter (side area of line number) or use debugger grammar.


Test in Webstorm

Start Debugger by launch

repoduce:

  1. open package.json in the project
  2. click editor gutter same row as debug:swc-node, Then select debug 'debug:swc-node'
  3. visit http://localhost:3000 on browser.
  4. Then the program into the breakpoint, but it didn't stop at the right place. If you operate the debugger, it won't jump correctly.

If you delete debugger in the line six on app.ts, repeat the above steps, you will find the debugger does not stop at breakpoints.

Start Debugger by attach

repoduce:

  1. run command npm run attach:swc-node on Terminal, it will print debugger listening address
  2. click the address, webstorm will auto start debugger to attach to the program.
  3. then the terminal will print Debugger attached.
  4. visit http://localhost:3000 on browser. The debugger do not stop at breakpoints.

Test in VSCode

Start Debugger by launch

repoduce:

  1. open Run and Debug panel
  2. select the config debug:swc-node, and run it
  3. visit http://localhost:3000 on browser.
  4. vscode will open another compiled app.ts file in editor.

Start Debugger by attach

repoduce:

  1. run command npm run attach:swc-node on Terminal, it will print debugger listening address
  2. change the debug config attach:swc-node, update the field remoteRoot
  3. visit http://localhost:3000 on browser.
  4. vscode will open another compiled app.ts file in editor.


If start debugger with the script debug:ts-node, the debugger will trigger breakpoints correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions