-
Notifications
You must be signed in to change notification settings - Fork 7
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
opt out of top level wrapping entry tag name when using renderToString
#114
Comments
I know overriding with a flag seems like a quick escape hatch (but it works!) but otherwise, given this type of entry module import './foo.component.js';
export class FooComponent extends HTMLElement {
// ...
}
customElements.define('foo-component', FooComponent);
export default class MyComponent extends HTMLElement {
// ...
} How would you know that I wonder if this will also mess with the definition return value? |
So yeah, top metadata definitions get a little compromised here as well in this "big bundle" scenario. So given this input class Navigation extends HTMLElement {
connectedCallback() {
this.innerHTML = `
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/artists">Artists</a></li>
<ul>
</nav>
`;
}
}
customElements.define('wcc-navigation', Navigation);
class Header extends HTMLElement {
connectedCallback() {
this.innerHTML = `
<header class="header">>
<h4>My Personal Blog</h4>
</header>
`;
}
}
export default Header; This is the current metadata output
I wonder if |
Type of Change
Feature
Summary
With
renderToString
currently, if you have a custom element that has acustomElements.define
call in it, e.g.The HTML string produced will come out with a wrapping tag for
MyComponent
Details
The issue is two fold
import
with their owncustomElements.define
statementEven if you have no define call for
MyComponent
Your bundled code is going to have something like this
The rendered HTML will come out like this now, because WCC just looks for the first
customElements.define
call it sees in the fileSo in some cases, the wrapping my be warrented / desired, in other cases not. Probably best to give control to that so in bundling / single file cases, the final output can be better managed
The text was updated successfully, but these errors were encountered: