Minified production code is difficult to debug from a stack trace. Source maps can map it back to authored files, but publicly serving a map may reveal source code that was not intended to be distributed.

Use the monitoring provider's upload path

  • Generate maps during the build and upload them with a deployment or release identifier.
  • Configure the web server or bundler not to expose the map files publicly when that matches your source policy.
  • Restrict map access in the monitoring service to the people and systems that need it.

Verify the release mapping

Trigger a known test error in a non-production environment and confirm the reported file and line map to the correct release. Remove uploaded maps when the provider's retention policy or your own policy requires it.

Source maps improve diagnosis; they do not replace access controls, secret scanning, or safe error handling. Never place credentials in source code on the assumption that a production map is private.