The error message isn't very helpful, but I believe that it shouldn't be erroring in the first place.
Simply adding :host{} fixes the issue, but the empty case should be handled.
Steps to recreate
Create an element with the following code:
export default function TestElement({ html }) {
return html`<style></style>`;
}
Add the element to a page
Navigate to the page
Expected
Page loads normally
Actual
The page isn't rendered
The following error message is shown instead:
Oops, something went wrong
TypeError: Cannot read properties of undefined (reading 'value')
at applyStyleTransforms (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:376:34)
at expandTemplate (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:164:32)
at file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:35:15
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:2:7)
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
at processCustomElements (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:27:5)
The error message isn't very helpful, but I believe that it shouldn't be erroring in the first place.
Simply adding
:host{}
fixes the issue, but the empty case should be handled.Steps to recreate
Create an element with the following code:
Add the element to a page
Navigate to the page
Expected
Actual