Skip to content

Commit 77d52d6

Browse files
committed
fix: 🐛 check if window is defined
1 parent 23b963b commit 77d52d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/helpers/get-zaraz.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* an error. Else returns the zaraz object.
44
*/
55
export function getZaraz() {
6-
if (!window?.zaraz) {
6+
if (typeof window !== 'undefined' && !window?.zaraz) {
77
throw new Error(
88
`Cannot use Zaraz Web API, because window.zaraz is not defined.`,
99
);

0 commit comments

Comments
 (0)