Skip to content

Commit

Permalink
Fix/node custom elements (#5235)
Browse files Browse the repository at this point in the history
* adapter-node fix CustomElementRegistry

* Add changeset

* Add fallback CustomElementRegistry
  • Loading branch information
ba55ie authored Oct 28, 2022
1 parent 5be3fde commit b6a478f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-mirrors-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/webapi': patch
---

Fix CustomElementRegistry for Node SSR Adapter
5 changes: 3 additions & 2 deletions packages/webapi/src/lib/CustomElementRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ export const initCustomElementRegistry = (
const CustomElementRegistry =
target.CustomElementRegistry || globalThis.CustomElementRegistry

const customElements: CustomElementRegistry = (target.customElements =
Object.create(CustomElementRegistry.prototype))
const customElements: CustomElementRegistry =
target.customElements ||
(target.customElements = new CustomElementRegistry())

_.INTERNALS.set(customElements, {
constructorByName: new Map(),
Expand Down

0 comments on commit b6a478f

Please sign in to comment.