Closed Granze closed 6 years ago
Do you have a reproduction repo?
Here we go: https://github.com/Granze/test-storybook
I am seeing this: Super expression must either be null or a function, not object
error when running storybook.
That is because of this line:
const HyperHTMLElement = require('hyperhtml-element')
;
It should be
const HyperHTMLElement = require('hyperhtml-element').default
;
or
import HyperHTMLElement from 'hyperhtml-element'
After that I am getting this error: Class constructor HyperHTMLElement cannot be invoked without 'new'
Which is already IMO related to how this framewrok should be rendered
First of all, thanks for pointing me out the import problem!
The element itself works just fine without any transpilation as you can see in this codepen.
The latest problem should be fixed using the following .babelrc
{
"plugins": [
"babel-plugin-transform-es2015-classes",
["babel-plugin-transform-builtin-classes", {
"globals": ["Array", "Error", "HTMLElement"],
"logIfPatched": true
}]
]
}
...but it seems to be ignored.
After removing babel-plugin-transform-es2015-classes
your example worked for me (in chrome).
oh, you are right. :) Thanks for helping me!
I'm trying out Storybook HTML with hyperHTML-Element. To make sure Babel will be able to transpile Custom Elements correctly I need to load a couple of plugins. I've added a .babelrc file in the root (I tried the .strorybook folder as well) but it seems to be ignored.
Here the versions of my devDependencies: