Closed wansiedler closed 2 years ago
Custom element names require a dash in them. Names without a dash like uiwiwidget
are therefore not valid. The browser prints this error otherwise:
To resolve this issue change the custom element name from <uiwiwidget>
to something like <x-uiwiwidget>
(best to use your custom prefix instead of x
).
import register from "preact-custom-element";
import './style';
import App from './components/app';
- register(App, "uiwiwidget");
+ register(App, "x-uiwiwidget");
...and in the HTML
<!-- ...snip -->
<% preact.bodyEnd %>
- <uiwiwidget></uiwiwidget>
+ <x-uiwiwidget></x-uiwiwidget>
</body>
</html>
Note that the HTML template is not watched in preact-cli. You might not to either restart the cli all the time or you can render your custom element from Preact in your JSX for a more interactive development setup.
Hello, this is my index.js:
template.html:
After yarn run dev or run build nothing happens. Page is empty. What should I do?