diff --git a/src/theming/theming-event.ts b/src/theming/theming-event.ts index 67956e6d8..1ef4498f3 100644 --- a/src/theming/theming-event.ts +++ b/src/theming/theming-event.ts @@ -1,9 +1,12 @@ +import { isServer } from 'lit'; import type { Theme, ThemeVariant } from './types.js'; class ThemeChangedEmitter extends EventTarget { constructor() { super(); - globalThis.addEventListener(CHANGE_THEME_EVENT, this); + if (!isServer) { + globalThis.addEventListener(CHANGE_THEME_EVENT, this); + } } public handleEvent() {