Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Class constructor HyperHTMLElement cannot be invoked without 'new' #38

Closed
dios-david opened this issue Oct 1, 2018 · 4 comments

Comments

@dios-david
Copy link

dios-david commented Oct 1, 2018

Hi everyone,

First of all, I would like to thank you for creating hyperHTML, it's amazing!
I want to play with it, especially with the HyperHTMLElement, but I have an error:

Uncaught TypeError: Class constructor HyperHTMLElement cannot be invoked without 'new'

I use Parcel with Babel 7.

Can you please help me on resolving this? I uploaded the project here:
https://github.com/dios-david/hyperhtml-test

Thanks in advance,
David

@Nevraeka
Copy link

Nevraeka commented Oct 3, 2018

@dios-david Have you tried Parcel 1.10.0?

@WebReflection
Copy link
Owner

This is not HyperHTMLHElement related issue, it's a transpiler one.

Be sure you are using latest Babel, be sure you are targeting the right browsers, be sure your bundler understand classes properly 'cause you gonna have problems with every other native extend otherwise.

@dios-david
Copy link
Author

Yes I know it's not related to HyperHTMLElement directly, it was intended as a question rather than a bug report :)
Btw for anyone else who has the same problem, the issue can be solved by adding some browser target to the Babel config, eg.:

"browserslist": [
    "last 1 chrome versions"
]

(related issue in Parcel project: parcel-bundler/parcel#839)

Thanks guys!

@WebReflection
Copy link
Owner

the issue can be solved by adding some browser target to the Babel config ...

watch out, you haven't fixed the issue, you have avoided the transpilation of classes. I think that is safe these days https://caniuse.com/#feat=es6-class but if you target IE11 or older browsers, you better follow my instructions ;-)

https://itnext.io/a-universal-bundle-loader-6d7f3e628f93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants