This plugin makes sure that your custom elements always have a name property, even after minifying.
In
class FooElement extends HTMLElement { }
Out
class FooElement extends HTMLElement {
static get name() {
return "FooElement";
}
}
$ npm install babel-plugin-ensure-name-for-custom-elements
.babelrc
{
"plugins": ["ensure-name-for-custom-elements"]
}
$ babel --plugins ensure-name-for-custom-elements script.js
require("babel-core").transform("code", {
plugins: ["ensure-name-for-custom-elements"]
});