{"id":19166,"library":"babel-plugin-source-map-support","title":"babel-plugin-source-map-support","description":"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.","status":"active","version":"2.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/chocolateboy/babel-plugin-source-map-support","tags":["javascript","babel-plugin","source-map","sourcemap","source-maps","sourcemaps","stack-trace","stacktrace","v8"],"install":[{"cmd":"npm install babel-plugin-source-map-support","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-source-map-support","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-source-map-support","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"runtime peer dependency; must be installed separately for the plugin to work","package":"source-map-support","optional":false}],"imports":[{"note":"Plugin is typically used via Babel config (string name 'source-map-support'), not imported directly. If importing programmatically, use ESM default import.","wrong":"const pkg = require('babel-plugin-source-map-support')","symbol":"default export","correct":"import pkg from 'babel-plugin-source-map-support'"},{"note":"Babel resolves plugin names without the 'babel-plugin-' prefix; use 'source-map-support' in plugins array.","wrong":"plugins: ['babel-plugin-source-map-support']","symbol":"Babel config plugin entry","correct":"plugins: ['source-map-support']"}],"quickstart":{"code":"// Install: npm install --save-dev babel-plugin-source-map-support source-map-support\n// .babelrc\n{\n  \"plugins\": [\"source-map-support\"],\n  \"sourceMaps\": \"inline\"\n}\n\n// Input: test.js\nimport foo from 'foo';\nfoo();\n\n// Compile: npx babel test.js --out-file test-compiled.js\n// Output: test-compiled.js will have import 'source-map-support/register' prepended","lang":"javascript","description":"Install plugin and runtime, configure in Babel, compile a file to see automatic source map support registration."},"warnings":[{"fix":"Run: npm install --save source-map-support","message":"Requires source-map-support package to be installed separately as a runtime dependency","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Do not use for browser production builds; scope to development only via Babel 'env' option.","message":"Only works in environments with v8 stack trace API (Node.js, Chrome). Harmless in others but no effect.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install --save source-map-support","cause":"source-map-support package not installed or not in node_modules","error":"Error: Cannot find module 'source-map-support/register'"},{"fix":"Upgrade Babel to version 7 or later, or use an older version of the plugin (not recommended).","cause":"Plugin requires Babel 7+; earlier versions not compatible","error":"Babel 6 is not supported"},{"fix":"Enable source maps in Babel config: 'sourceMaps: true' or 'sourceMaps: \"inline\"'","cause":"Source maps not generated or not loaded; plugin only adds registration, source maps must be generated separately","error":"Stack traces still show transpiled line numbers"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}