liveBook · Manning

Source map

As explained in Pro ASP.NET Core 7, Tenth Edition

A source map is a file that maps transformed code such as minified JavaScript back to its developer-readable source code.

Minification makes JavaScript smaller to deliver: it removes whitespace and replaces descriptive function and variable names with short ones. That trade-off makes a browser debugging session hard to follow. section 26.4.1

A source map is a .map file that links minified JavaScript to its developer-readable, unminified source. When you open the browser’s F12 developer tools, the browser automatically requests available source maps and uses them to help debug client-side code. section 26.4.1

A name you can recognize

Minification might turn myHelpfullyNamedFunction into x1. The short name saves space but is nearly useless when tracing a problem; a source map connects the minified code back to the readable source. section 26.4.1

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Defines the mapping file and describes automatic browser use, but does not explain how to generate one.
Examples
Contrasts myHelpfullyNamedFunction with its shortened minified name x1.
What it assumes
Assumes familiarity with JavaScript debugging while explaining why minification makes it difficult.
What you can do after
Diagnose/debug with it by opening F12 developer tools to inspect minified JavaScript with available source maps.
How it connects
Connects JavaScript minification, browser developer tools, and client-side debugging.

Also explained in

Compare how 2 books explain source map →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.