Skip to content

Empty <style> tags throw errors during rendering #70

Closed
@paulcuth

Description

@paulcuth

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)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions