source-maps-debugging

Configures source maps to map compiled JavaScript back to TypeScript for debugging.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill source-maps-debugging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: source-maps-debugging
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/source-maps-debugging
Command: npx skills add https://github.com/luyi985/lyi-bash --skill source-maps-debugging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Debugging TypeScript is challenging when stack traces and breakpoints reference emitted JavaScript. This Skill guides you to configure source maps so you can view and navigate TypeScript sources in browser DevTools or Node debuggers.

Core Features & Use Cases

  • Source map configuration: Align TypeScript outputs with browser and Node debuggers through tsconfig.json and build tool settings (webpack, vite, rollup).
  • Improved debugging workflow: Enable breakpoints in TS files and view original traces in DevTools.
  • Use Case: When stack traces show app.js:42, map it back to api.ts:15 to quickly locate the bug.

Quick Start

Enable source maps in your TypeScript project to map compiled JS back to TS and begin debugging.

Frequently Asked Questions about source-maps-debugging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug TypeScript in the browser when stack traces show compiled JavaScript?

Debugging TypeScript in the browser requires configuring source maps to map compiled JavaScript back to original TS files. This Skill guides you through tsconfig.json and build tool settings to align emitted JS with TS sources for accurate stack traces and breakpoints.

What is the best way to configure source maps for TypeScript with webpack?

The best way to configure TypeScript source maps with webpack involves adjusting tsconfig.json and webpack settings to generate and consume mapping files. This ensures browser DevTools correctly resolves compiled bundle lines back to their original TypeScript source locations.

Why do my TypeScript breakpoints not work in browser DevTools?

TypeScript breakpoints fail in browser DevTools when source maps are missing or misconfigured, preventing the debugger from mapping runtime JavaScript to TS files. You must enable correct source map generation and source root settings in your build tool configuration.

Does this source map configuration approach work with Vite and Rollup?

Yes, this source map configuration approach works with Vite, Rollup, and webpack. It guides you through the specific build tooling settings needed to emit source maps that correctly map TypeScript files to emitted JavaScript across these environments.

How do I map an error in app.js back to the original TypeScript file?

To map a runtime error in a compiled file like app.js back to the original TypeScript file, you need source maps. This Skill helps configure TS and build tool source map generation so stack traces display the original TS file and line numbers.

Can I use TypeScript source maps for debugging in Node.js?

Yes, you can use TypeScript source maps for debugging in Node.js as well as the browser. This Skill configures source maps to bridge TypeScript source code with runtime JavaScript, enabling accurate stack traces and breakpoints in Node debuggers.