Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-ensure-name-for-custom-elements

github70.0.2

This plugin makes sure that your custom elements always have a name property, even after minifying.

custom, element, name, babel-plugin

readme

babel-plugin-ensure-name-for-custom-elements

This plugin makes sure that your custom elements always have a name property, even after minifying.

Example

In

class FooElement extends HTMLElement { }

Out

class FooElement extends HTMLElement {
  static get name() {
    return "FooElement";
  }
}

Installation

$ npm install babel-plugin-ensure-name-for-custom-elements

Usage

.babelrc

{
  "plugins": ["ensure-name-for-custom-elements"]
}

Via CLI

$ babel --plugins ensure-name-for-custom-elements script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["ensure-name-for-custom-elements"]
});