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/javascript/compile-typescript-code-npm.md
+21-5Lines changed: 21 additions & 5 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: Compile and build TypeScript code using npm
3
3
description: Add TypeScript support to your Visual Studio projects by using the Node Package Manager (npm) package for portability across different platforms and environments.
4
-
ms.date: 10/23/2023
4
+
ms.date: 5/15/2025
5
5
ms.topic: conceptual
6
6
author: "mikejo5000"
7
7
ms.author: "mikejo"
@@ -31,11 +31,11 @@ The [TypeScript npm package](https://www.npmjs.com/package/typescript) adds Type
31
31
32
32
::: moniker range=">=vs-2022"
33
33
For projects created using the JavaScript Project System (JSPS), or *.esproj*, no additional workloads are needed. You just need to install npm (https://www.npmjs.com/), which is included with Node.js.
34
-
35
-
For the older project type (.njsproj), you need to install the Node.js development workload and the Node.js runtime.
36
34
::: moniker-end
37
35
38
36
::: moniker range="vs-2019"
37
+
For the Node.js project type (.njsproj), you need to install the Node.js development workload and the Node.js runtime.
38
+
39
39
[Follow instructions](./tutorial-nodejs.md?toc=%252fvisualstudio%252fjavascript%252ftoc.json) to install the Node.js development workload and npm (https://www.npmjs.com/), which is included with Node.js.
40
40
41
41
For a simple Visual Studio integration, create your project using one of the Node.js TypeScript templates, such as the Blank Node.js Web Application template. Else, use either a Node.js JavaScript template included with Visual Studio and follow instructions here. Or, use an [Open Folder](../javascript/develop-javascript-code-without-solutions-projects.md) project.
@@ -45,7 +45,9 @@ The [TypeScript npm package](https://www.npmjs.com/package/typescript) adds Type
45
45
46
46
From Solution Explorer (right pane), open the *package.json* in the project root. The packages listed correspond to packages under the npm node in Solution Explorer. For more information, see [Manage npm packages](../javascript/npm-package-management.md).
47
47
48
-
For a Node.js project, you can install the TypeScript npm package using the command line or the IDE. To install using the IDE, right-click the npm node in Solution Explorer, choose **Install New npm package**, search for **TypeScript**, and install the package.
48
+
::: moniker range="vs-2019"
49
+
For the older Node.js project type, you can install the TypeScript npm package using the command line or the IDE. To install using the IDE, right-click the npm node in Solution Explorer, choose **Install New npm package**, search for **TypeScript**, and install the package.
50
+
::: moniker-end
49
51
50
52
Check the **npm** option in the **Output** window to see package installation progress. The installed package shows up under the **npm** node in Solution Explorer.
51
53
@@ -114,10 +116,17 @@ The [TypeScript npm package](https://www.npmjs.com/package/typescript) adds Type
114
116
For an example of using Vue.js with TypeScript, see [Create a Vue.js application](create-application-with-vuejs.md).
115
117
::: moniker-end
116
118
117
-
1. If you need to configure options such as the startup page, path to the Node.js runtime, application port, or runtime arguments, right-click the project node in Solution Explorer, and choose **Properties**.
119
+
1. If you need to configure build and deployment options such as the app URL or runtime commands, right-click the project node in Solution Explorer, and choose **Properties**.
120
+
121
+
::: moniker range=">=vs-2022"
122
+
>[!NOTE]
123
+
> When configuring third-party tools, projects using the JavaScript Project System (JSPS), or *.esproj*, don't use the paths that are configured under **Tools** > **Options** > **Projects and solutions** > **Web Package Management** > **External Web Tools**. These settings are used for other project types.
124
+
::: moniker-end
118
125
126
+
::: moniker range="vs-2019"
119
127
>[!NOTE]
120
128
> When configuring third-party tools, Node.js projects don't use the paths that are configured under **Tools** > **Options** > **Projects and solutions** > **Web Package Management** > **External Web Tools**. These settings are used for other project types.
129
+
::: moniker-end
121
130
122
131
1. Choose **Build > Build Solution**.
123
132
@@ -141,8 +150,15 @@ Press **Ctrl+F5** (or **Debug > Start Without Debugging**) to run the applicatio
141
150
142
151
You can use Task Runner Explorer in Visual Studio to help automate tasks for third-party tools like npm and webpack.
143
152
153
+
::: moniker range=">=vs-2022"
154
+
-[NPM Task Runner](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.NpmTaskRunner64) - Adds support for npm scripts defined in *package.json*. Supports yarn.
155
+
-[Webpack Task Runner](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebPackTaskRunner) - Adds support for webpack.
156
+
::: moniker-end
157
+
158
+
::: moniker range="vs-2019"
144
159
-[NPM Task Runner](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.NPMTaskRunner) - Adds support for npm scripts defined in *package.json*. Supports yarn.
145
160
-[Webpack Task Runner](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebPackTaskRunner) - Adds support for webpack.
0 commit comments