Course contentsShow
← Web Development
Lesson 2283 of 2,98241. Debugging TechniquesFree lesson

Debugging with Source Maps in DevTools

Using browser DevTools to set breakpoints, step through, and debug original source code via source maps.

Debugging with Source Maps in DevTools

You'll learn how to use browser DevTools to debug your original source code instead of minified production code by leveraging source maps.

The Core Idea

When you've configured your build tools to generate source maps (as covered in previous lessons), DevTools can automatically load and use them to map minified production code back to your original source files. This means you can set breakpoints, step through code, and inspect variables in your actual source files—even though the browser is executing transformed, bundled, or minified code.

Think of it like having X-ray vision: the browser sees the compiled output, but DevTools shows you the original blueprint.

Using Source Maps in DevTools

When source maps are present and DevTools is configured to use them (usually enabled by default), the Sources panel will display your original folder structure and files instead of minified bundles. You'll see familiar filenames like app.js or UserService.ts rather than cryptic bundle.min.js.

You can then:

  • Set breakpoints in your original source files by clicking line numbers
  • Step through your actual code using Step Over, Step Into, and Step Out
  • Inspect variables with their original names in the Scope panel and Watch expressions
  • View the Call Stack with meaningful function and file names
  • Read error messages that reference your source files and line numbers

The debugging experience feels identical to working with uncompiled code, but you're actually debugging production-ready builds.

Verifying Source Map Loading

Check the Sources panel tree—if you see your original files organized by folder, source maps are working. If you only see minified bundles, ensure your source map files are accessible and your DevTools settings haven't disabled them.

Key Takeaway: With properly configured source maps, DevTools transparently translates between production code and your original source, letting you debug using familiar file names, line numbers, and variable names as if you were working directly with uncompiled code.