WebReflection / hyperHTML-Element

An extensible class to define hyperHTML based Custom Elements.
ISC License
202 stars 25 forks source link

Super expression must either be null or a function, not object #19

Closed giotramu closed 6 years ago

giotramu commented 6 years ago

I get "Super expression must either be null or a function, not object" error when I run index.js:

My index.js code:

import hyperHTML from 'hyperhtml';
import HyperHTMLElement from 'hyperhtml-element';

class SimpleElement extends HyperHTMLElement {
  created() {
    this.render();
  }

  render() {
    return this.html`DO IT`;
  }
}

SimpleElement.define('x-simple');

My index.html code:

<x-simple></x-simple>

My package.json file: http://jsoneditoronline.org/?id=16781014c5a73885d395019ba5fcc317

What have I done wrong?

WebReflection commented 6 years ago

As you can see in this CodePen everything is fine.

There are two differences:

It looks indeed like you are transpiling code but Babel < 7 is not compatible with native extend.

You might need to add an extra step to your transpilation which is this plugin which is included in Babel 7 https://github.com/WebReflection/babel-plugin-transform-builtin-classes