Skip to content

Commit fe1b833

Browse files
authored
fix: window is undefined cause an error (#1486)
`navigator` maybe created by miniapp(or other sth), but `window` still is undefined
1 parent 4604fd8 commit fe1b833

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/api/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function getDevtoolsGlobalHook (): any {
1414

1515
export function getTarget (): GlobalTarget {
1616
// @ts-ignore
17-
return typeof navigator !== 'undefined'
17+
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
1818
? window
1919
: typeof global !== 'undefined'
2020
? global

0 commit comments

Comments
 (0)