
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
babel-plugin-source-map-support
Advanced tools
A Babel plugin which automatically makes stack traces source-map aware
babel-plugin-source-map-support - a Babel plugin which automatically makes stack traces source-map aware
$ npm install source-map-support --save
$ npm install babel-plugin-source-map-support --save-dev
$ cat test.js
import foo from 'foo';
import bar from 'bar';
foo(bar);
$ babel --plugins source-map-support test.js
import 'source-map-support/register';
import foo from 'foo';
import bar from 'bar';
foo(bar);
This is a Babel plugin which prepends the following statement to source files:
import 'source-map-support/register';
In conjunction with the source-map-support module, which must be installed separately, this statement hooks into the v8 stack-trace API to translate call sites in the transpiled code back to their corresponding locations in the original code.
Note: this only works in environments which support the v8 stack-trace API (e.g. Node.js and Chrome), though it's harmless in other environments.
The source-map-support module only needs to be registered in the top-level file(s) of an application, but it no-ops if it has already been loaded, so there is no harm in registering it in every file.
You probably don't want to use this plugin when compiling code for the web
because you probably don't want to bundle source-maps and the source-map module
in minified code. An easy way to limit the plugin's scope to development/test
builds is to use Babel's env option
e.g.:
{
env: {
development: {
sourceMaps: 'inline',
plugins: ['source-map-support', ...]
}
},
presets: [ ... ]
}
Note that source-maps don't need to be inlined in each file. They can be
externalised by using the { sourceMaps: true } option, which adds a link
to the bottom of each file which points to its external source-map e.g.:
{
env: {
development: {
sourceMaps: true,
plugins: ['source-map-support', ...]
}
},
}
// index.js footer:
//# sourceMappingURL=index.js.map
The following NPM scripts are available:
dist directorydist directory and other build artifactstest script in debug mode, which dumps each transformed test case2.1.1
Copyright © 2015-2019 by chocolateboy.
This module is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
FAQs
A Babel plugin which automatically makes stack traces source-map aware
The npm package babel-plugin-source-map-support receives a total of 116,322 weekly downloads. As such, babel-plugin-source-map-support popularity was classified as popular.
We found that babel-plugin-source-map-support demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.