From 478f637d0b0d24d671528ad9072c7ab391868a09 Mon Sep 17 00:00:00 2001 From: Marco Link Date: Thu, 20 Jan 2022 15:45:57 +0100 Subject: [PATCH] feat(node): remove native module dependency As a cross runtime library (browser/node), we should not rely on native modules. The current version is not compatible with environments like remix.run. This PR fixes the issue --- src/get-user-agent.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/get-user-agent.ts b/src/get-user-agent.ts index 671feed..7afa81b 100644 --- a/src/get-user-agent.ts +++ b/src/get-user-agent.ts @@ -1,5 +1,3 @@ -import os from 'os' - import { isNode, getNodeVersion, isReactNative, getWindow } from './utils' function getBrowserOS(): string | null { @@ -32,8 +30,8 @@ function getBrowserOS(): string | null { type PlatformMap = Record function getNodeOS(): string | null { - const platform = os.platform() || 'linux' - const version = os.release() || '0.0.0' + const platform = process.platform || 'linux' + const version = process.version || '0.0.0' const platformMap: PlatformMap = { android: 'Android', aix: 'Linux',