Reputation: 9238
I thought the reason the new VS Code debugger stopped on the 'use strict';
in my file was because of some weird deprecatory behaviour in new versions of Node, or else because my code had some weird error in it.
Then I realised that "break on first line" is a thing, and one that people want. Why on earth is this a thing? I know that my script has a first line, thank you very much. I'd have bigger problems if it didn't. So why does the debugger need to do this?
Upvotes: 4
Views: 2824
Reputation: 143
In launch.json there is a property stopOnEntry which is set to true by default. If you don't want to Node Debugger to "break on first line" set this property to false.
Upvotes: 7
Reputation: 60507
The reason "break on first line" is a feature, is so that you can run your application, and have it stop on the first line before continuing.
This allows you to attach a debugger before Node has executed some of the code. This enables you to debug the very first lines of code, set more breakpoints, or step over the lines of code whenever you are ready.
This is actually a pretty common feature in a debugger, especially if you don't necessarily have a way to set breakpoints before you run the code.
Upvotes: 6