Source Map Types and Quality Levels
You'll learn how different source map configurations trade accuracy for build speed, and which to choose for development versus production.
The Quality Spectrum
Not all source maps are created equal. Build tools offer various quality levels that balance how much original source information they preserve against how fast they generate. Think of it like photo quality settings: higher fidelity takes more time and storage.
Common Source Map Types
From fastest (least accurate) to slowest (most accurate):
eval
Wraps each module in eval() with no source map. Fastest rebuild, but you only see transformed code. Good for: nothing—avoid it.
eval-source-map
Uses eval() with inline source maps per module. Fast rebuilds with full original source and column mappings. Good for: development when speed matters more than file size.
cheap-source-map
External map without column information, only line-level mapping. Good for: faster production builds where you don't need exact column positions.
cheap-module-source-map
Like cheap-source-map but processes loader transformations. Better for TypeScript or JSX where you want to see your actual source syntax, not transpiler output.
source-map
Full-quality external source map with line and column information. Slowest, most accurate. Good for: production debugging when you need perfect fidelity.
Choosing Your Map
Development typically uses eval-source-map or cheap-module-source-map for fast rebuilds. Production uses source-map (if any) because build speed matters less than accurate debugging when investigating real user issues.
The "cheap" variants skip column mappings, which speeds generation significantly but makes debugging slightly less precise—you'll know the line but not the exact expression.
Key Takeaway: Source map types range from fast-but-inaccurate eval variants to slow-but-perfect source-map, letting you trade build performance for debugging precision based on whether you're developing or deploying.