Fix/node custom elements (#5235)

* adapter-node fix CustomElementRegistry

* Add changeset

* Add fallback CustomElementRegistry
This commit is contained in:
Sebastiaan 2022-10-28 18:34:30 +02:00 committed by GitHub
parent 5be3fdec27
commit b6a478f376
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/webapi': patch
---
Fix CustomElementRegistry for Node SSR Adapter

View file

@ -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(),