JSPM

babel-plugin-stack-trace-sourcemap

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q65716F
  • License Artistic-2.0

A Babel 6 plugin that automatically makes stack traces sourcemap aware. Requires V8.

Package Exports

  • babel-plugin-stack-trace-sourcemap

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-stack-trace-sourcemap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-stack-trace-sourcemap

npm status

A Babel plugin which automatically makes stack traces source-map aware

INSTALL

npm install babel-plugin-stack-trace-sourcemap --save-dev

or

yarn add babel-plugin-stack-trace-sourcemap -D

SYNOPSIS

$ cat test.js

import foo from 'foo';
import bar from 'bar';

test();

$ babel test.js

'use strict';

var foo = require('foo');
var bar = require('bar');

test();

$ babel --plugins source-map-support test.js

'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:

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:

'plugins': [
    ['babel-plugin-stack-trace-sourcemap', {
        'importOverride': ['source-map-support', 'install', '_sourceMapSupport'],
        'execute': true
    }]
]

CAVEATS

Source maps must currently be inline. While the source-map-support module provides a way to associate a file with an external source map, that is not currently supported by this plugin.

SEE ALSO

VERSION

1.0.0

AUTHOR

Forked by: Cameron Yan (Khell) Original author: chocolateboy

Copyright © 2015-2017 by khell, chocolateboy

This module is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.