Back to results for “Debugging”
JavaScript › Debugging, Testing & Tooling

How does source mapping help when debugging minified or transpiled code?

Intermediate

Answer

A source map is a file that maps positions in generated (minified/transpiled) code back to the original source, so browser DevTools can show you readable original code and correct line numbers even though the browser is actually running the bundled output.
//# sourceMappingURL=app.min.js.map
// tells DevTools where to find the mapping file
Real-world example Debugging a production error stack trace that points to original TypeScript source, not the minified bundle.

Common follow-ups: Why should source maps typically not be publicly exposed on production servers?