You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/using-breakpoints.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Use the right type of breakpoint
3
3
description: Learn about the different types of breakpoints, one of the most important debugging techniques. The article covers breakpoint actions, tracepoints, conditions, and much more.
Copy file name to clipboardExpand all lines: docs/javascript/debug-nodejs.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Debug a JavaScript or TypeScript app"
3
3
description: Debug JavaScript and TypeScript applications in Visual Studio, reach breakpoints in your code, attach the debugger, inspect variables, view the call stack, and more.
4
-
ms.date: "07/09/2024"
4
+
ms.date: "07/23/2025"
5
5
ms.topic: "how-to"
6
6
ms.devlang: javascript
7
7
author: "mikejo5000"
@@ -61,7 +61,13 @@ Visual Studio provides client-side debugging support only for Chrome and Microso
61
61
62
62
For more detailed information, see this [blog post for Google Chrome](https://devblogs.microsoft.com/aspnet/client-side-debugging-of-asp-net-projects-in-google-chrome). For debugging TypeScript in ASP.NET Core, see [Add TypeScript to an existing ASP.NET Core app](tutorial-aspnet-with-typescript.md).
63
63
64
+
::: moniker range=">=vs-2022"
65
+
- For *.esproj* projects in Visual Studio 2022, you can debug client-side script using standard debugging methods to hit breakpoints. To configure debugging, you can modify *launch.json* settings, which work the same as in VS Code. For more information about debugger configuration options, see [Launch configuration attributes](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-attributes).
66
+
::: moniker-end
67
+
68
+
::: moniker range="vs-2019"
64
69
- For Node.js applications and other JavaScript projects, follow the steps described in this article.
70
+
::: moniker-end
65
71
66
72
>[!NOTE]
67
73
> For ASP.NET and ASP.NET Core, debugging embedded scripts in *.CSHTML* files is not supported. JavaScript code must be in separate files to enable debugging.
@@ -72,7 +78,11 @@ If your source is minified or created by a transpiler like TypeScript or Babel,
72
78
73
79
For help with generating source maps, see [Generate source maps for debugging](#generate_source_maps).
74
80
75
-
### <aname="prepare_the_browser_for_debugging"></a> Prepare the browser for debugging
81
+
### <aname="prepare_the_browser_for_debugging"></a> Manually configure the browser for debugging
82
+
83
+
::: moniker range=">=vs-2022"
84
+
In Visual Studio 2022, the procedure described in this section is available only in ASP.NET and ASP.NET Core applications. It is required only in uncommon scenarios where you need to customize browser settings. In *.esproj* projects, the browser is configured for debugging by default.
85
+
::: moniker-end
76
86
77
87
For this scenario, use either Microsoft Edge or Chrome.
78
88
@@ -113,6 +123,8 @@ For this scenario, use either Microsoft Edge or Chrome.
113
123
### Attach the debugger to client-side script
114
124
115
125
::: moniker range=">=vs-2022"
126
+
In some scenarios, you may need to attach the debugger to a running app.
127
+
116
128
To attach the debugger from Visual Studio and hit breakpoints in the client-side code, it needs help with identifying the correct process. Here's one way to enable it.
117
129
118
130
1. Make sure your app is running in the browser in debug mode, as described in the preceding section.
@@ -125,7 +137,7 @@ To attach the debugger from Visual Studio and hit breakpoints in the client-side
125
137
126
138
To find the specific code in a transpiled file, use **Ctrl**+**F** (**Edit** > **Find and Replace** > **Quick Find**).
127
139
128
-
For client-side code, to hit a breakpoint in a TypeScript file, *.vue*, or *JSX* file typically requires the use of [source maps](#generate_source_maps). A source map must be configured correctly to support debugging in Visual Studio.
140
+
For client-side code, to hit a breakpoint in a TypeScript file, *.vue*, or *JSX* file typically requires the use of [source maps](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps). A source map must be configured correctly to support debugging in Visual Studio.
129
141
130
142
1. Choose **Debug** > **Attach to Process**.
131
143
@@ -152,7 +164,7 @@ To attach the debugger from Visual Studio and hit breakpoints in the client-side
152
164
153
165
You may hit the breakpoint in either a transpiled `.js` file or source file, depending on your app type, which steps you followed previously, and other factors such as your browser state. Either way, you can step through code and examine variables.
154
166
155
-
* If you need to break into code in a TypeScript, JSX, or `.vue` source file and are unable to do it, make sure that your environment is set up correctly, as described in the [Troubleshooting](#troubleshooting_source_maps) section.
167
+
* If you need to break into code in a TypeScript, JSX, or `.vue` source file and are unable to do it, make sure that your environment is set up correctly, as described in the [Source maps](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps) section of the VS Code documentation.
156
168
157
169
* If you need to break into code in a transpiled JavaScript file (for example, *app-bundle.js*) and are unable to do it, remove the source map file, *filename.js.map*.
158
170
::: moniker-end
@@ -201,6 +213,7 @@ To attach the debugger from Visual Studio and hit breakpoints in the client-side
201
213
* If you need to break into code in a transpiled JavaScript file (for example, *app-bundle.js*) and are unable to do it, remove the source map file, *filename.js.map*.
202
214
::: moniker-end
203
215
216
+
::: moniker range="vs-2019"
204
217
### <aname="troubleshooting_source_maps"></a> Troubleshooting breakpoints and source maps
205
218
206
219
If you need to break into code in a TypeScript or JSX source file and are unable to do it, use **Attach to Process** as described in the previous section to attach the debugger. Make sure that your environment is set up correctly:
@@ -278,6 +291,7 @@ If you add a `tsconfig.json` file to your project, Visual Studio treats the dire
278
291
-**sourceRoot**: Specifies the location where the debugger should find TypeScript files instead of the source locations. Use this flag if the run-time sources need to be in a different location than the location at design-time. The location specified is embedded in the source map to direct the debugger to where the source files are located.
279
292
280
293
For more details about the compiler options, check the page [Compiler Options](https://www.typescriptlang.org/docs/handbook/compiler-options.html) on the TypeScript Handbook.
294
+
::: moniker-end
281
295
282
296
::: moniker range="vs-2019"
283
297
### Configure source maps using project settings (TypeScript project)
0 commit comments