Should I publish source maps on my site or keep them private?

Keep them private unless you want anyone to read your original code. A public .map file usually holds your full source text. Upload the maps to Monitoring instead, then delete them from the deploy output. Monitoring strips the source text before storing a map, never serves maps over HTTP, and still shows original files, lines and function names.

Last updated 26 November 2026. By Paul Badarau.

A fictional freelancer ships a booking site for a dental practice. The build writes app-5e2a.js and app-5e2a.js.map, and the bundle ends with //# sourceMappingURL=app-5e2a.js.map. Anyone can open that map from the live site and read the original code, comments included, because the map's sourcesContent field carries every source file.

Decide by what the code would reveal:

  • Publish maps when the code is public already, such as an open-source project, and you want visitors' developer tools to show readable code.
  • Keep them private when the code holds business rules, unreleased features, internal API paths or comments you would not post. Most client and commercial sites are in this group.
  • Neither choice hides secrets. An API key in the bundle is readable in the minified file with or without a map, so keep secrets out of browser code.

To keep maps private and still read clear stack traces:

  1. Use your bundler's hidden source map setting, such as build.sourcemap: 'hidden' in Vite or devtool: 'hidden-source-map' in webpack. It writes the .map files without the comment that points browsers at them.
  2. Inject debug IDs and upload the maps to Monitoring with the Project's upload token.
  3. Delete the maps before the deploy step copies the output, for example with find dist -name '*.map' -delete.
  4. Request a .map address on the live site and confirm that it returns 404.

Monitoring removes sourcesContent before it stores a map and keeps only the mappings, file names and function names. It never serves a map over HTTP. It reads a map only to rewrite a stack frame when someone opens an issue, and it deletes the Workspace's maps when the Workspace's data is deleted.

Private maps still show names inside Monitoring. Everyone in the Workspace, Viewers included, sees your original file paths and function names in stack traces. A client you invite as a Viewer sees them too. Monitoring shows no source lines, because it never stores them, so you open the file in your editor to see the code around the error.

The product page for this is Monitoring.

Start your 14-day free trial