Skip to content

Commit 3545fd5

Browse files
author
Luca Forstner
authored
fix(nextjs): Silence warning about usage of process in runtimes where it is not available (#9394)
1 parent 6d9a766 commit 3545fd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/utils/src/isBrowser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isNodeEnv } from './node';
2+
import { GLOBAL_OBJ } from './worldwide';
23

34
/**
45
* Returns true if we are in the browser.
@@ -12,5 +13,8 @@ type ElectronProcess = { type?: string };
1213

1314
// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them
1415
function isElectronNodeRenderer(): boolean {
15-
return typeof process !== 'undefined' && (process as ElectronProcess).type === 'renderer';
16+
return (
17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
18+
(GLOBAL_OBJ as any).process !== undefined && ((GLOBAL_OBJ as any).process as ElectronProcess).type === 'renderer'
19+
);
1620
}

0 commit comments

Comments
 (0)