babel-plugin-transform-class-prototype-name
v1.0.1
Published
Manaully sets a classes prototype.name after each definition
Downloads
2
Readme
babel-plugin-class-display-name
After the creation of each class, the plugin manually sets the prototype.name to the class name. This means that after minification class errors still report correctly if you dont have source maps enabled.
Installation
$ npm install babel-plugin-class-prototype-name
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["class-prototype-name"]
}
Via CLI
$ babel --plugins class-prototype-name script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["class-prototype-name"]
});
Compilation
In
class CustomError extends Error {}
Out
class CustomError extends Error {}
CustomError.prototype.name = "CustomError";
After minification
class a extends Error {}
a.prototype.name = "CustomError";