diff --git a/packages/core/src/router.ts b/packages/core/src/router.ts index 586b6d918..fdd2f0aff 100644 --- a/packages/core/src/router.ts +++ b/packages/core/src/router.ts @@ -114,6 +114,10 @@ export class Router { type: TEventName, callback: (event: GlobalEvent) => GlobalEventResult, ): VoidFunction { + if (typeof window === 'undefined') { + return () => {} + } + return eventHandler.onGlobalEvent(type, callback) }