A .map file can hold the full original source of every file that went into the bundle. If it's in the tarball, anyone who runs npm pack on your package has it.

Originally published on ReleaseShield.

1. What's actually in a .map

{ "version": 3, "sources": ["../src/client.ts", "../src/auth.ts"], "sourcesContent": ["import ... // full original file", "..."], "mappings": "AAAA,SAAS..." } 

sources leaks file names and layout. sourcesContent is the actual pre-build code, comments, internal URLs and TODOs included. Without sourcesContent a map is mostly noise; with it, minification undid nothing.

2. How common it is

Of the 500 popular packages we scanned, 284 (57%) publish .map files and 195 (39%) inline sourcesContent. For open-source packages that's just weight. For a closed-source SDK, CLI or paid library it's the codebase. Full numbers: npm tarball audit 2026.

3. Check a tarball in 30 seconds

# your package, before publishing npm pack # or anything already on the registry npm pack some-package@latest mkdir t && tar -xzf *.tgz -C t find t -name '*.map' | while read f; do jq -r --arg f "$f" '(.sourcesContent // []) | map(select(. != null)) | length | if . > 0 then "\($f): \(.) files of source inlined" else empty end' "$f" done 

No output means no inlined source. Maps without sourcesContent still expose paths; decide if you need them at all.

4. Turn it off where it's made

Tool Default Fix
tsc no source unless inlineSources drop "inlineSources": true, or "sourceMap": false in the publish tsconfig
esbuild includes source sourcesContent: false (CLI: --sources-content=false)
Rollup includes source output.sourcemapExcludeSources: true
Vite no maps unless build.sourcemap is set leave build.sourcemap off for the published build
webpack devtool: false in production mode if you need maps: devtool: "nosources-source-map"

5. Or keep them out of the tarball

If you want maps for your own error tracker, upload them there and exclude them from the package. With a files allowlist, ignore files can't remove anything it includes, so negate inside the array:

"files": ["dist", "!dist/**/*.map"] 

Using .npmignore instead? Read the .npmignore trap first: it replaces .gitignore, so dist/*.map in .gitignore stops applying the moment you add one.

Why your git scanner says nothing

Maps are build output. They're gitignored, never committed, and written to disk right before npm publish. Push protection and history scanners only see commits. The tarball is the only place to look.

Check any published package before you ship it: scan a package or upload a tarball, free.