question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript dependency breakpoints not hit when using JavaScript Debug Terminal

See original GitHub issue

Describe the bug

I have a typescript library which I’m publishing with sourcemaps, but breakpoints in the .ts files are not hit when invoked from the JavaScript Debug Terminal.

To Reproduce

I’ve created a stand-alone repo here: https://github.com/icholy/typescript_breakpoint_bug

  1. npm i.
  2. Open vscode and set breakpoint at node_modules/@icholy/no-ts-breakpoint-bug/src/index.ts:3.
  3. Open Javascript Debug Terminal and run node main.js.

Log File: Not sure how to do this with the JavaScript Debug Terminal.

VS Code Version: 1.71.2

Additional Notes:

  • If you npm link the package, the breakpoints work.
  • If you use a launch config, the breakpoints work.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
icholycommented, Sep 30, 2022

I’ve pushed my workspace configuration to the linked repo.

1reaction
connor4312commented, Sep 29, 2022

Yep, you can also set the debug.javascript.terminalOptions in your user or workspace settings.

If this is default behavior, why isn’t it finding the source maps?

Your case is having a breakpoint at node_modules/@icholy/no-ts-breakpoint-bug/src/index.ts:3. Because it’s in node_modules, this is excluded by default. Note that you probably want to only add node modules you want to set breakpoints in rather than removing the !**/node_modules/** negation entirely, for performance reasons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio code breakpoint not working on Node.js using ...
1 Answer 1 · Add the start script to package.json · click on the debug menu icon on the left side navigation menu....
Read more >
How to Debug Typescript and Hit Breakpoints | 2018 - YouTube
Using Webpack and Source maps we can debug Typescript TS code by setting ... Typescript file even though it's the compiled Javascript JS...
Read more >
Debug Node.js Apps using Visual Studio Code
The Visual Studio Code editor includes Node.js debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
TypeScript Debugging Inside VSCode
In order to do that we need to have mappers, that map our TS files to the JS ones, and using those mappers...
Read more >
How to debug TypeScript with VS Code - Philipp Kief - Medium
Now you can open the debug view (Ctrl-Shift-D) of VS Code. By clicking to the left of a line number you can add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found