Skip to content

Commit e1c6273

Browse files
Bugfix for SSR ReferenceError: document is not defined (#84)
* Update web.ts * Update web.ts * Update package.json * Update package.json * Update web.ts * Update web.ts * Update web.ts
1 parent 3e6364a commit e1c6273

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "npm run clean && tsc",
99
"clean": "rm -rf ./dist",
1010
"watch": "tsc --watch",
11-
"prepublishOnly": "npm run build"
11+
"prepublishOnly": "npm run build",
12+
"prepare": "tsc"
1213
},
1314
"author": "CodetrixStudio",
1415
"license": "MIT",

src/web.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ export class GoogleAuthWeb extends WebPlugin implements GoogleAuthPlugin {
1010
gapiLoaded: Promise<void>;
1111

1212
get webConfigured(): boolean {
13-
return document.getElementsByName('google-signin-client_id').length > 0;
13+
if (typeof document !== 'undefined') {
14+
return document.getElementsByName('google-signin-client_id').length > 0;
15+
} else {
16+
return false;
17+
}
1418
}
1519

1620
constructor() {

0 commit comments

Comments
 (0)