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:
- open package.json in the project
- click editor gutter same row as
debug:swc-node, Then select debug 'debug:swc-node'
- visit
http://localhost:3000 on browser.
- 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:
- run command
npm run attach:swc-node on Terminal, it will print debugger listening address
- click the address, webstorm will auto start debugger to attach to the program.
- then the terminal will print
Debugger attached.
- visit
http://localhost:3000 on browser. The debugger do not stop at breakpoints.
Test in VSCode
Start Debugger by launch
repoduce:
- open Run and Debug panel
- select the config
debug:swc-node, and run it
- visit
http://localhost:3000 on browser.
- vscode will open another compiled app.ts file in editor.
Start Debugger by attach
repoduce:
- run command
npm run attach:swc-node on Terminal, it will print debugger listening address
- change the debug config attach:swc-node, update the field remoteRoot
- visit
http://localhost:3000 on browser.
- 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.
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.
Test in Webstorm
Start Debugger by launch
repoduce:
debug:swc-node, Then selectdebug 'debug:swc-node'http://localhost:3000on browser.Start Debugger by attach
repoduce:
npm run attach:swc-nodeon Terminal, it will print debugger listening addressDebugger attached.http://localhost:3000on browser. The debugger do not stop at breakpoints.Test in VSCode
Start Debugger by launch
repoduce:
debug:swc-node, and run ithttp://localhost:3000on browser.Start Debugger by attach
repoduce:
npm run attach:swc-nodeon Terminal, it will print debugger listening addresshttp://localhost:3000on browser.