Production source maps that publish your app's original source code

Last updated November 13, 2026
Steps
- Open your live site, open the browser's developer tools, and look in the Sources panel for your original folder names (src/, app/, components/). If you can read your own unminified code, maps are public.
- Or request a bundle URL with .map added (for example /_next/static/chunks/<file>.js.map). A 200 response with JSON means the map is being served.
- In Next.js, remove productionBrowserSourceMaps: true from next.config. In Vite, set build.sourcemap to false, or 'hidden' if you need maps for an error tracker.
- If you use Sentry or a similar tool, upload maps to it during the build and delete them from the deployed output instead of serving them publicly.
- Search your client code for anything that should never have been there (API keys, internal URLs, admin routes, TODOs about security). Source maps make these easy to find, and minification alone doesn't hide them.
- Rotate any secret you find in client code. Once it has been served, assume it has been copied.
Why it matters
The Next.js docs say production source maps are disabled by default to prevent leaking your source to the client, and that once enabled, Next.js automatically serves the .map files next to your JavaScript. Vite's build.sourcemap option defaults to false, and its 'hidden' setting generates maps without linking them from the bundle. Public maps hand attackers a readable copy of your front-end logic, including any client-side secrets, hidden routes and comments. MITRE classifies the underlying weakness as CWE-540, Inclusion of Sensitive Information in Source Code. Turning maps off isn't a fix for secrets in client code, though: anything shipped to the browser is readable either way, so secrets belong on the server.
Sources
Next.js docs: productionBrowserSourceMaps — https://nextjs.org/docs/app/api-reference/config/next-config-js/productionBrowserSourceMaps
Vite docs: Build options (build.sourcemap) — https://vite.dev/config/build-options
Sentry docs: Source maps for JavaScript — https://docs.sentry.io/platforms/javascript/sourcemaps/
MITRE CWE-540: Inclusion of Sensitive Information in Source Code — https://cwe.mitre.org/data/definitions/540.html
Related patterns
- API secret keys shipped in your frontend bundle
- Third-party secret keys (OpenAI, Stripe, Resend) in client JS
- Exposed .env or .git on a deployed site
- Error messages that leak stack traces, queries or keys
- Passwords, tokens and personal data written to your logs
- Debug or preview mode left on in production
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.