Challenge 2: What Source Maps Solve, and Their Production Trade-Off — Possible Solution ==================================================================== THE PROBLEM SOURCE MAPS SOLVE ------------------------------ Per this chapter's own explanation, once code has been transpiled and then minified/bundled, what's actually executing in the browser "looks nothing like the source a developer wrote" — variable names may be shortened, modern syntax rewritten into older equivalents, and multiple original files merged into one. Without any help, opening browser DevTools to debug this code would show only that unrecognizable transformed output — a breakpoint would land on mangled code, and a stack trace would reference meaningless generated variable names, making genuine debugging extremely difficult. HOW SOURCE MAPS FIX THIS ------------------------------ Per this chapter's own definition, a source map is a file that maps every position in the transformed output back to its EXACT original position in the source code the developer actually wrote. Browser DevTools read this mapping automatically, which lets a developer set breakpoints and read stack traces in terms of the ORIGINAL, readable source — even though the code genuinely running is the transformed version. The developer experience stays close to "debug what I wrote," despite the code that's actually executing being something else entirely underneath. THE PRODUCTION TRADE-OFF ------------------------------ Per this chapter's own warn-box, shipping source maps publicly in a production deployment means anyone inspecting the live site can use that same mapping to reconstruct the original, un-minified source code — a real business and security consideration, not a hypothetical one, since it can expose source code a company might prefer to keep private. Per the chapter's own explanation, this is why many production deployments either generate source maps only for internal error-tracking tools (never exposed publicly) or omit them from the production build entirely — a deliberate choice, not an oversight. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains the specific debugging problem source maps solve (mangled, unreadable code showing up in DevTools without them) using the chapter's own wording, describes the mechanism precisely (mapping transformed positions back to original ones), and states the real production trade-off (exposing original source code publicly) rather than treating source maps as an unconditionally good, cost-free feature.