Skip to content

Commit

Permalink
fix(env): Fix regression in isBrowser() check (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy authored Mar 9, 2024
1 parent ae2ed19 commit b734e1b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/env/src/lib/is-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {isElectron} from './is-electron';

/** Check if in browser by duck-typing Node context */
export function isBrowser(): boolean {
// @ts-expect-error
const isNode = typeof process === 'object' && !process?.browser;
const isNode =
// @ts-expect-error
typeof process === 'object' && String(process) === '[object process]' && !process?.browser;
return !isNode || isElectron();
}

0 comments on commit b734e1b

Please sign in to comment.