Skip to content

Commit 36e6e4d

Browse files
committed
👷 improve node detection
1 parent 1be6315 commit 36e6e4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎packages/core/src/tools/globalObject.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ export const globalObject = getGlobalObject<GlobalObject>()
5050

5151
export const isBrowserEnvironment = 'document' in globalObject
5252
export const isWorkerEnvironment = 'WorkerGlobalScope' in globalObject
53-
// @see https://stackoverflow.com/questions/4224606/how-to-check-whether-a-script-is-running-under-node-js
54-
// @ts-expect-error module is undefined outside of Node.
55-
export const isNodeEnvironment = typeof module !== 'undefined' && module.exports
53+
export const isNodeEnvironment =
54+
// @ts-expect-error for Node.js-specific globals that are not present in browser environments
55+
typeof process !== 'undefined' && process.versions !== null && process.versions.node !== null

0 commit comments

Comments
 (0)