From 40e140afb7aa0b0bc58cdb7fddd37bcec3ce4351 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Wed, 13 May 2015 10:13:32 +0200 Subject: [PATCH] `register` module (fix #52) --- README.md | 17 +++++++++++++++++ register.js | 1 + 2 files changed, 18 insertions(+) create mode 100644 register.js diff --git a/README.md b/README.md index feaa5e3..035a101 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,23 @@ Source maps can be generated using libraries such as [source-map-index-generator The path should either be absolute or relative to the compiled file. +It is also possible to to install the source map support directly by +requiring the `register` module which can be handy with ES6: + +```javascript +import 'source-map-support/register' + +// Instead of: +import sourceMapSupport from 'source-map-support' +sourceMapSupport.install() +``` + +It is also very useful with Mocha: + +``` +mocha --require source-map-support/register tests/ +``` + #### Browser support This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code. diff --git a/register.js b/register.js new file mode 100644 index 0000000..4f68e67 --- /dev/null +++ b/register.js @@ -0,0 +1 @@ +require('./').install();