Source maps in production: is your app's original source code public?
Updated 28 October 2026
Your production JavaScript is minified: one long, unreadable line. A source map is a separate file (usually something.js.map) that maps that line back to your original files, so a debugger can show the real code. That's great while you develop. If the map is public on your live site, though, anyone can rebuild a readable copy of your frontend code, including comments, file names and code you thought nobody would see.
Check your own app for this, free.
Paste your live URL. ShipCheck looks for leaked API keys in your page and JavaScript, exposed files like /.env and /.git, missing security headers, SSL certificate problems, domain expiry (custom domains only) and what Google sees without running JavaScript. You'll see your score without signing up.
Short answer
Public source maps are a medium risk. They don't give anyone access by themselves, but they make your app much easier to study and attack, and sometimes they contain secrets. Check your live site for .map files. Turn them off for production builds (in Vite and Next.js they're off unless something turned them on). If you need them for error monitoring, upload them privately to your error tracker and don't deploy them.
What a public source map gives away
- Your original code, readable: component names, folder structure and the logic behind paywalls, admin checks and feature flags. Browser DevTools rebuild the full
src/tree automatically. - Comments and leftovers: TODOs, "temporary" workarounds, commented-out code, and test credentials someone pasted in a comment.
- Internal routes and endpoints: admin pages, unfinished features, internal API paths and Edge Function names.
- Sometimes keys. A source map usually includes each original file in full (the
sourcesContentfield). That can include a key the bundler removed as unused, or one sitting in a comment. Any secret that reached the browser was already public in the bundle, though: the map just makes it easier to find. See is it safe to put an API key in the frontend?
What it does not expose: code that only runs on a server (API routes, Edge Functions, server components), your database, or your environment variables, unless they were bundled into the browser code.
How to check your live app
In the browser
- Open your live site, right-click and choose View page source. Find the
<script src="…">tags. Vite apps (Lovable, Bolt) usually load something like/assets/index-AbC123.js, and Next.js apps load files under/_next/static/. - Open that JS file and scroll to the very end. A last line like
//# sourceMappingURL=index-AbC123.js.mappoints to the map. - Whether or not that line is there, add
.mapto the JS URL and open it. If you get JSON starting with something like{"version":3,"sources":[…], the map is public. If you get your homepage or a 404, it isn't. Single-page apps often answer any unknown URL with the homepage, so check what loads, not just whether something does. - Or open DevTools → Sources. A readable
src/folder with your component files means maps are being loaded.
A map can also be inline: the end of the JS file contains sourceMappingURL=data:application/json;base64,…. Then your full source ships inside the bundle itself.
From a terminal
URL=https://your-app.com
for js in $(curl -s "$URL" | grep -oE 'src="[^"]+\.js[^"]*"' | cut -d'"' -f2); do
case "$js" in http*) u="$js";; /*) u="$URL$js";; *) u="$URL/$js";; esac
echo "$u"
curl -s "$u" | tail -c 300 | grep -o 'sourceMappingURL=[^ ]*' | cut -c1-80
if curl -s "${u%%\?*}.map" | grep -q '"mappings"'; then echo " PUBLIC SOURCE MAP: ${u%%\?*}.map"; fi
doneThis only checks scripts linked directly from the page HTML. Code-split chunks that load later can have maps too, so also check a few files from the DevTools Network tab.
How to turn them off (or keep them private)
Vite (Lovable, Bolt and most React SPAs)
Vite's build.sourcemap option defaults to false, so a plain Vite build doesn't produce maps. If yours does, look in vite.config.ts:
sourcemap: truewrites separate.mapfiles next to your bundles, and they get deployed with everything else.sourcemap: 'inline'puts the whole map inside each JS file, which is the worst option for production.sourcemap: 'hidden'still writes.mapfiles and only leaves out thesourceMappingURLcomment. The files are still served if you deploy them, at the same URL plus.map. Only use'hidden'together with an upload step that deletes the files afterwards (see below).
// vite.config.ts
export default defineConfig({
build: {
sourcemap: false, // the default; remove true / 'inline' for production
},
});On Lovable or Bolt, you can ask: "Make sure production builds don't generate or publish source maps (build.sourcemap false in vite.config)."
Next.js (v0, Cursor)
Next.js disables browser source maps in production unless you opt in with productionBrowserSourceMaps: true in next.config. When that's on, Next.js serves the maps alongside your JS automatically. Remove the line, or set it to false, unless you deliberately want public maps. While you're in next.config, check you're on a patched version: Next.js security updates for vibe coders.
Other setups
- Create React App: it generates maps for production builds unless you set
GENERATE_SOURCEMAP=false(CRA advanced configuration). - webpack: the
devtoolsetting decides this.hidden-source-mapworks like Vite's'hidden': the files are still written, so delete them or block.maprequests on your server.
Keep error monitoring without public maps
Error trackers like Sentry need source maps to turn minified stack traces into readable ones. Sentry says the maps don't have to be public once they're uploaded, and recommends removing them from your production deployment. The usual pattern:
- Vite + Sentry: set
build.sourcemap: 'hidden'and add@sentry/vite-pluginwithsourcemaps.filesToDeleteAfterUpload(for example["./dist/**/*.map"]), so the maps are uploaded and then deleted before deploy (Sentry Vite plugin docs). - Next.js + Sentry:
withSentryConfighassourcemaps.deleteSourcemapsAfterUpload, which defaults totrue. It deletes the client maps in.next/static/after upload and keeps server-side maps, which aren't public (Sentry Next.js build options). - Other trackers (Bugsnag, Rollbar, Datadog and so on) have similar upload tools. The rule is the same: upload during the build, then don't deploy the
.mapfiles.
After you fix it
- Redeploy, then rerun the check above. The
.mapURLs should return your 404 page or the homepage, not JSON. - Older deployments can still be reachable at their own URLs (on Vercel, each deployment has its own address). If they served maps, protect or delete those deployments too.
- If a public map contained a secret key, rotate the key. Removing the map doesn't un-leak it. See which keys to rotate, and in what order.
- Read your own source the way a stranger would. Anything that only "works" because the code is hidden, like a client-side admin check or a paywall enforced in the browser, needs a server-side check instead.
Checklist
- Find your production JS files in View source or the Network tab.
- Check the end of each file for
sourceMappingURL, includingdata:inline maps. - Request each JS URL plus
.mapand confirm you don't get source map JSON. - Vite:
build.sourcemapisfalse(or'hidden'only with upload-and-delete). - Next.js: no
productionBrowserSourceMaps: true. - Error tracker: maps are uploaded privately and deleted before deploy.
- Old deployments that served maps are protected or deleted.
- Any key you find in a map is rotated, not just removed.
Does ShipCheck check for source maps?
Yes. The free scan fetches your page and the same-origin JavaScript files it links to. For up to 8 of them, it looks for a public source map, following the sourceMappingURL comment or trying the bundle URL plus .map. It only counts a response that really is a source map, not a homepage fallback. Public maps are reported as "Your original source code is public (source maps)". ShipCheck also scans the maps it finds for known secret key formats, and never shows more than the first 6 characters of a key. Inline data: maps are part of the JavaScript it already scans for keys, but they aren't reported as a separate public source map. Paid plans re-run the scan automatically, weekly on Solo ($12/mo) or daily on Builder ($29/mo), so a later change that turns maps back on gets caught.
FAQ
Are source maps in production a security risk?
Public ones are a medium risk. They let anyone read your original frontend code, including comments, file names, internal routes and logic like admin checks, which makes your app much easier to study and attack. They can also contain secrets from comments or code the bundler removed. They don't expose server-only code or environment variables that never reached the browser.
Does Vite generate source maps in production by default?
No. Vite's build.sourcemap option defaults to false. If your Lovable or Bolt app serves .map files, something set sourcemap to true, 'inline' or 'hidden' in vite.config, or an error-monitoring plugin turned them on. Set it back to false, or use 'hidden' only together with an upload step that deletes the maps before deploy.
Does Next.js expose source maps in production?
Not by default. Next.js disables browser source maps in production builds unless productionBrowserSourceMaps is set to true in next.config. When it's on, Next.js serves the .map files next to your JavaScript automatically, so remove the option unless you really want public maps.
What does sourcemap: 'hidden' do in Vite?
It generates the .map files but leaves out the sourceMappingURL comment from your bundles. The maps are still in your build output, and if you deploy them they're downloadable at the bundle URL plus .map. Use 'hidden' only when an upload plugin (for example Sentry's filesToDeleteAfterUpload) deletes the maps before deploy.
How do I use Sentry without public source maps?
Upload maps to Sentry during the build and don't deploy them. For Vite, set build.sourcemap to 'hidden' and configure @sentry/vite-plugin with sourcemaps.filesToDeleteAfterUpload. For Next.js, withSentryConfig's sourcemaps.deleteSourcemapsAfterUpload defaults to true and removes client maps after upload. Sentry says uploaded maps don't need to be public.
Does ShipCheck check my app for exposed source maps?
Yes. The free scan checks the source maps of up to 8 same-origin JavaScript files linked from your page, via the sourceMappingURL comment or the bundle URL plus .map. It only reports real source map files and scans them for known secret key formats, showing at most the first 6 characters of any key. Inline data: maps aren't reported separately, but their contents are part of the JavaScript it scans for keys.
Run the same checks on your app.
A free scan takes under a minute. No card, and no sign-up to see your score and the list of issues.