From 377cfc8ecd53d3377fd540bd6e0f9d8e1ed8f051 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 27 Oct 2023 13:16:33 +0000 Subject: [PATCH 1/2] fix(nextjs): Silence warning about usage of `process` in runtimes where it is not available --- packages/utils/src/isBrowser.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/utils/src/isBrowser.ts b/packages/utils/src/isBrowser.ts index aa0a4bfa11db..b9c87e985736 100644 --- a/packages/utils/src/isBrowser.ts +++ b/packages/utils/src/isBrowser.ts @@ -1,7 +1,9 @@ import { isNodeEnv } from './node'; +import { GLOBAL_OBJ } from './worldwide'; /** * Returns true if we are in the browser. + * @deprecated */ export function isBrowser(): boolean { // eslint-disable-next-line no-restricted-globals @@ -12,5 +14,8 @@ type ElectronProcess = { type?: string }; // Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them function isElectronNodeRenderer(): boolean { - return typeof process !== 'undefined' && (process as ElectronProcess).type === 'renderer'; + return ( + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any + (GLOBAL_OBJ as any).process !== undefined && ((GLOBAL_OBJ as any).process as ElectronProcess).type === 'renderer' + ); } From aa625c200f182cc5d2dbccf9346cfbc7f82ad28e Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 27 Oct 2023 13:41:17 +0000 Subject: [PATCH 2/2] Don't deprecate --- packages/utils/src/isBrowser.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/utils/src/isBrowser.ts b/packages/utils/src/isBrowser.ts index b9c87e985736..1670d347f4bb 100644 --- a/packages/utils/src/isBrowser.ts +++ b/packages/utils/src/isBrowser.ts @@ -3,7 +3,6 @@ import { GLOBAL_OBJ } from './worldwide'; /** * Returns true if we are in the browser. - * @deprecated */ export function isBrowser(): boolean { // eslint-disable-next-line no-restricted-globals