babel-plugin-stack-trace-sourcemap
INSTALL
npm install babel-plugin-stack-trace-sourcemap --save-dev
or
yarn add babel-plugin-stack-trace-sourcemap -D
SYNOPSIS
$ cat test.js
```javascript
import foo from 'foo';
import bar from 'bar';
test();
```
$ babel test.js
```javascript
'use strict';
var foo = require('foo');
var bar = require('bar');
test();
```
$ babel --plugins source-map-support test.js
```javascript
'use strict';
require('source-map-support/register');
var foo = require('foo');
var bar = require('bar');
test();
```
DESCRIPTION
This is a Babel 6 plugin which prepends a statement equivalent to the following to source files: ```javascript require('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 is harmless in other environments. The source-map-support module only needs to be registered in the top-level file 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 may specify a custom import declaration and whether to immediately execute a default export function in your Babel config. This is the effective default configuration: ```javascript 'plugins':['babel-plugin-stack-trace-sourcemap', {
'importOverride': ['source-map-support', 'install', '_sourceMapSupport'],
'execute': true
}]
```