PWI Software Documentation Help

Debugging React Apps Written in TypeScript

Debugging is an essential part of any developer's workflow. However, debugging TypeScript in a React app requires some additional setup. This guide will show you how to set up your development environment to debug a React web app written in TypeScript.

VS Code

Set Up Debugging in VS Code

  1. Open your project in VS Code.

  2. Ensure that package.json contains a "start": "react-scripts start" script.

  3. Ensure that tsconfig.json has "sourceMap": true in the compilerOptions object.

  4. Ensure the following configurations are set up in your launch.json file.

    { "default": "Start and Debug React App", // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Start React App", "type": "node-terminal", "request": "launch", "command": "npm start", "cwd": "${workspaceFolder}" }, { "name": "Debug React App", "type": "chrome", "request": "launch", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}/src", "sourceMaps": true, "trace": true }, { "name": "Attach to Chrome", "type": "chrome", "request": "attach", "port": 9222, "webRoot": "${workspaceFolder}/src", "sourceMaps": true, "trace": true } ], "compounds": [ { "name": "Start and Debug React App", "configurations": ["Start React App", "Debug React App"] } ] }
  5. Press F5 to begin debugging.

JetBrains WebStorm

Set Up Debugging in WebStorm

  1. Open your project in WebStorm.

  2. Ensure that package.json contains a "start": "react-scripts start" script.

  3. Ensure that tsconfig.json has "sourceMap": true in the compilerOptions object.

  4. Follow the instructions listed in the WebStorm documentation. Debug a TypeScript application running on an external web server.

21 November 2025