Registry / devops / babel-plugin-source-map-support

babel-plugin-source-map-support

JSON →
library2.2.0jsnpmunverified

A Babel plugin (v2.2.0) that automatically prepends `import 'source-map-support/register'` to every transpiled file, enabling source-map-aware stack traces in v8 environments (Node.js, Chrome). It requires the separate `source-map-support` runtime dependency (v0.5+). Unlike manual registration or other plugins, it works with all Babel 7 presets and can be scoped to development builds via the `env` option. Stable, low maintenance, no known breaking changes since v1.

npm install babel-plugin-source-map-support
INSTALL
IMPORT
SIG · BABEL-PLUGIN-SOURC
B
babel-plugin-source-map-support
devopsjavascriptv2.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
import pkg from 'babel-plugin-source-map-support'
const pkg = require('babel-plugin-source-map-support')
Plugin is typically used via Babel config (string name 'source-map-support'), not imported directly. If importing programmatically, use ESM default import.
Babel config plugin entry
plugins: ['source-map-support']
plugins: ['babel-plugin-source-map-support']
Babel resolves plugin names without the 'babel-plugin-' prefix; use 'source-map-support' in plugins array.

Install plugin and runtime, configure in Babel, compile a file to see automatic source map support registration.

// Install: npm install --save-dev babel-plugin-source-map-support source-map-support // .babelrc { "plugins": ["source-map-support"], "sourceMaps": "inline" } // Input: test.js import foo from 'foo'; foo(); // Compile: npx babel test.js --out-file test-compiled.js // Output: test-compiled.js will have import 'source-map-support/register' prepended
Debug
Known issues
gotchaRequires source-map-support package to be installed separately as a runtime dependency
fix
Run: npm install --save source-map-support
affects: >=1.0.0
gotchaOnly works in environments with v8 stack trace API (Node.js, Chrome). Harmless in others but no effect.
fix
Do not use for browser production builds; scope to development only via Babel 'env' option.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'source-map-support/register'
source-map-support package not installed or not in node_modules
fix
Run: npm install --save source-map-support
Babel 6 is not supported
Plugin requires Babel 7+; earlier versions not compatible
fix
Upgrade Babel to version 7 or later, or use an older version of the plugin (not recommended).
Stack traces still show transpiled line numbers
Source maps not generated or not loaded; plugin only adds registration, source maps must be generated separately
fix
Enable source maps in Babel config: 'sourceMaps: true' or 'sourceMaps: "inline"'
Upgrade
Version history
2.2.0latest on npm
Audit
Dependencies
source-map-supportrequiredruntime peer dependency; must be installed separately for the plugin to work
Agent activity
32 hits · last 30 days
node
29
OpenAI (training)
1
Resources
babel-plugin-source-map-support — npm install babel-plugin-source-map-support · libregistry