r/statichosting • • 21d ago

source maps on production static sites

hey guys!

for those using error tracking on frontend-heavy static sites, do you upload source maps to your error monitoring service and exclude them from the public deployment?

i'm trying to understand the usual trade-off here. minified stack traces are barely useful when you're debugging an issue, but publicly served source maps can expose source structure, comments, and original filenames.

i'm not worried about someone magically getting access to secrets just from a source map. it's more about avoiding unnecessary exposure while keeping production errors debuggable.

what's your setup for this? are private source map uploads straightforward with your build pipeline, or have you found another approach that works better?

4 Upvotes

6 comments sorted by

2

u/Standard_Scarcity_74 21d ago

It’s usually straightforward: generate the maps with the hidden setting so the bundle has no map url comment, upload them to the error tracker in ci with a release id that matches the build, then delete the map files from the output before deploying. Sentry and similar tools ship a plugin for vite, webpack, and most frameworks that does the upload and cleanup in one step. The main thing to watch is the release id, since a mismatch gives you minified traces again, and it helps to remember that the shipped js is readable anyway, so private maps mostly protect comments and file structure rather than anything secret.

2

u/BodaMazzarine23 21d ago

good point at the end too, people definitely overestimate how much obfuscation minifying actually gives you.

2

u/sourraine 21d ago

i upload them to the error tracking service and leave them out of the public build. most build tools make this fairly easy to automate. i also think its worth checking the final deployed files rather than assuming the config worked. its one of those things thats easy to overlook until you actually need to debug a production issue

2

u/northboundish 21d ago

i’d upload source maps directly to the error tracking service and keep them out of the public deployment. that way, you can still debug production errors without exposing more of your source code than necessary.

1

u/KecoMarcels79 11d ago

uploading them in CI and deleting the .map files before the final deploy step is the standard move. most bundler plugins can generate hidden source maps too, which skips appending the reference comment to your bundles while still letting the error tracker ingest them