Debug production JavaScript with source maps

8 steps · about 2 h 55 min · Intermediate

  1. Map generated code back to source (guide, MDN Web Docs, 20 min)

    See how a debugger resolves minified locations into readable files and lines.

  2. Connect a resource to its map (reference, MDN Web Docs, 12 min)

    Learn the response header that can identify a source map without an inline comment.

  3. Understand source-map contents and tradeoffs (guide, web.dev, 30 min)

    Relate mappings, source files and names to debugging value and exposure risk.

  4. Inspect mapped code in Chrome DevTools (guide, Chrome for Developers, 25 min)

    Confirm that breakpoints and stack traces resolve against the intended source version.

  5. Remove framework noise from call stacks (guide, Chrome for Developers, 18 min)

    Ignore known third-party scripts so the relevant application frames remain visible.

  6. Choose a webpack map mode deliberately (reference, webpack documentation, 25 min)

    Balance rebuild speed, mapping quality and whether source content appears in deployed artifacts.

  7. Generate linked or external maps with esbuild (reference, esbuild documentation, 20 min)

    Apply the same deployment decision in a second common build tool.

  8. Verify release and artifact matching (guide, Sentry documentation, 25 min)

    Finish by checking the frequent causes of unmapped production stack traces.