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

[Bug] defineAsCustomElements component #69

Closed
2 tasks done
jrson83 opened this issue Dec 5, 2021 · 3 comments
Closed
2 tasks done

[Bug] defineAsCustomElements component #69

jrson83 opened this issue Dec 5, 2021 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jrson83
Copy link
Contributor

jrson83 commented Dec 5, 2021

Describe the bug
No matter what I try I get this error when using customElements:

customElements.define(componentName, class extends HTMLElement {
    ^

ReferenceError: customElements is not defined

Here is a Sandbox Link

Also the usage of CustomElementsMode on the docs is missing some really usefull required information like import module, export component and actuall usage example.

Have a question?
Can you please fix it, or describe how to use it right if it's not a bug?
If the usage is working I would like to provide some more infos for the docs.

Todo

@yandeu
Copy link
Member

yandeu commented Dec 5, 2021

Thanks for reporting this issue.

customElements does only work in the browser (https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements)

You are also rendering <HomePage /> on the server.

I guess I should make this component isomorphic.

Just added some tasks.

@yandeu yandeu added bug Something isn't working enhancement New feature or request labels Dec 5, 2021
@jrson83
Copy link
Contributor Author

jrson83 commented Dec 5, 2021

Ah right, I didn't realize it wasn't isomorphic. I setup with client only and it works.
I gonna experiment and then update the docs.

@jrson83
Copy link
Contributor Author

jrson83 commented Dec 29, 2021

Closed with 5656e30

@jrson83 jrson83 closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants