Skip to content

Commit 9adb170

Browse files
authored
fix: failed access globalThis in legacy browsers (#2139)
1 parent 411d25f commit 9adb170

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/src/client/overlay.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { registerOverlay } from './hmr'
1+
import { registerOverlay } from './hmr';
22

33
function stripAnsi(content: string) {
44
const pattern = [
@@ -163,7 +163,7 @@ const overlayTemplate = `
163163
const {
164164
HTMLElement = class {} as typeof globalThis.HTMLElement,
165165
customElements,
166-
} = globalThis;
166+
} = typeof window !== 'undefined' ? window : globalThis;
167167

168168
class ErrorOverlay extends HTMLElement {
169169
constructor(message: string[]) {

0 commit comments

Comments
 (0)