JavaScript Interview Question #163
What is a source map?
Performance, Browser APIs, Rendering & Modern Web Architecture Senior Advanced
Quick Interview Answer
A source map maps generated or transformed JavaScript back to the original source files and locations. It is useful when code has been bundled, transpiled, or minified.
Detailed Explanation
A source map maps generated or transformed JavaScript back to the original source files and locations. It is useful when code has been bundled, transpiled, or minified.
Developer tools and error-monitoring systems can use source maps to show meaningful original stack traces. Production teams should decide carefully how maps are published and protected because they can reveal source structure.
Code Example
// Build tools commonly emit:
// app.min.js
// app.min.js.map
// app.min.js may include:
// //# sourceMappingURL=app.min.js.map