Source Map Support is a Node.js module that enhances stack traces for transpiled or bundled JavaScript by resolving them back to the original source files using source maps. When code is compiled from TypeScript, CoffeeScript, Babel, or bundlers like Webpack, errors normally point to the generated code; this module intercepts V8’s stack trace API and remaps paths and line numbers to their original locations. The output closely mimics Node’s native stack format, so it feels like standard stack traces—but with your original source filenames and line numbers instead of opaque build artifacts. It’s designed to be easy to enable: you can require it programmatically or load it via a register hook so that all subsequent errors benefit. Because it relies on the source-map library, it works across a wide range of build systems that emit standard source maps.
Features
- Translates Node.js stack traces to original source positions using source maps
- Hooks into V8’s stack trace API without changing your application code structure
- Supports many compile-to-JS languages and bundlers that emit standard source maps
- Can be enabled via a one-line require or register module
- Preserves Node’s familiar stack trace formatting for easy adoption
- Helps make TypeScript and other transpiled languages feel native when debugging