Bundling TypeScript and JavaScript

This section uses the DOMManipulation project version based on modules created in the Pitfalls of namespaces and ES6 modules section of Chapter 6, Namespaces and Modules.

WebPack is installed with npm. It is enough to add it to the package.json file of the DOMManiupation example, which should look like this:

{  "version": "1.0.0",  "name": "ASP.NET",  "private": true,    "devDependencies": {        "@types/jquery": "^3.3.4",    }}

It was already used to load the package containing jQuery and TypeScript definitions. Anyway, it is worth recalling how to add package.json to a Visual Studio project:

  1. Right-click on the project root (it should be named DOMManipulation) and select Add | New Item.
  2. Under Web | Scripts select

Get Hands-On TypeScript for C# and .NET Core Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.