Skip to content

Commit 0111a7a

Browse files
cmoniz-oceanunyo
andauthored
fix: update is-browser.ts to account undefined navigator (#1868)
* Update is-browser.ts Fixes electron 12.2.3, which doesn't have navigator defined 6a03d29#commitcomment-142114121 * Making recommended changes #1868 (review) --------- Co-authored-by: Cody Moniz <[email protected]>
1 parent c36a4b0 commit 0111a7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/is-browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const isStandardBrowserEnv = () => {
44
// Is the process an electron application
55
// check if we are in electron `renderer`
66
const electronRenderCheck =
7-
navigator?.userAgent?.toLowerCase().indexOf(' electron/') > -1
7+
typeof navigator !== 'undefined' &&
8+
navigator.userAgent?.toLowerCase().indexOf(' electron/') > -1
89
if (electronRenderCheck && process?.versions) {
910
const electronMainCheck = Object.prototype.hasOwnProperty.call(
1011
process.versions,

0 commit comments

Comments
 (0)