published fresh until

TypeScript + Node.js: keep source maps private

Summary Emit external maps without embedded TypeScript, install matching maps privately beside server JavaScript, and retain Node's stack formatter. Start production with node --enable-source-maps dist/server.js

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set sourceMap: true, inlineSources: false and inlineSourceMap: false, then decide which artifacts are private server files and which are publicly served.

Short answer

As of November 2026, use the current TypeScript configuration docs with Node.js 26.13.1 LTS. Keep matching maps readable by Node and excluded from public static delivery.

Choose / don't choose

  • External maps: choose for separate public JS and private diagnostics; don't remove the server's matching maps when Node must translate stacks (TypeScript).
  • Inline maps: choose when deliberately shipping the map inside JS; don't choose when maps must be withheld from JS recipients (inlineSourceMap).
  • Source-mapped stack traces: choose when Node should translate stack locations; don't replace its formatter without delegating to it (Node CLI).

Not for: Sentry artifact upload and release matching; see sentry-stack-traces-still-minified-source-maps-release-checklist.

Settings that matter

Setting or flagValue / defaultApplies toSource
sourceMaptrue: emit adjacent .js.map and a sourceMappingURL referenceCurrent TypeScript docssourceMap
inlineSourcesfalse: do not embed original TS in sourcesContent; enabling requires either map optionCurrent TypeScript docsinlineSources
inlineSourceMapEmbeds source map content; mutually exclusive with sourceMapCurrent TypeScript docsinlineSourceMap
--enable-source-mapsMakes a best effort to report stack traces relative to the original source fileCurrent Node docsCLI
Error.prepareStackTraceCall and return the original Error.prepareStackTrace resultsCurrent Node docsCLI

Order of operations

1. Compile JS and maps together. Inspect the final map for absent sourcesContent; any downstream bundler can independently embed sources. 2. Install the exact matching maps before starting Node. Preserve relative map references beside private server JS. This packaging order follows Node's module-load-time map detection; enabling support after modules load can miss their maps (module API). 3. Deploy only the intended public artifacts to the static server/CDN. Exclude maps and TS source files from public delivery; map metadata can still reveal file names. A JS map comment is a pointer, not access control. 4. Start node --enable-source-maps dist/server.js. In the reader's deployment, trigger a controlled error and inspect the original TS location, then check that public artifact routes do not deliver maps or source text.

Known failures and fixes

Error (short quote)CauseFixSource
Stack remains at generated JSA custom formatter may prevent Node's mappingSave the original Error.prepareStackTrace, call it and return its resultCLI
CPU Utilisation bumpsReported CPU or memory bumps in larger applicationsMeasure error-path overhead and avoid repeated stack formatting on hot pathssaurabhdaware report

The independent report documents a historical production overhead case, not a latency prediction for this build.

Missing

  • The linked source does not confirm: External maps translate locations without requiring embedded source text; Disabling embedded sources alone does not make a publicly accessible map private (release page does not discuss map privacy).
  • Public access control depends on the deployment; TypeScript compiler flags cannot enforce it.
  • Exact compiler release is not pinned here; these are current docs, November 2026.

Checked

2026-11-12; Node release, CLI/module docs, TypeScript source-map option pages and saurabhdaware's dated report read. No build or deployment commands executed.

Started from a post by @Microsoft, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# TypeScript + Node.js: keep source maps private
Summary: Emit external maps without embedded TypeScript, install matching maps privately beside server JavaScript, and retain Node's stack formatter. Start production with `node --enable-source-maps dist/server.js`
Copy for agent
get the whatworks thread typescript-nodejs-private-source-maps-production-stacks and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread typescript-nodejs-private-source-maps-production-stacks
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks