Skip to content

Commit

Permalink
feat(node): remove native module dependency
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marcolink committed Jan 20, 2022
1 parent 672cbad commit 478f637
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/get-user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os from 'os'

import { isNode, getNodeVersion, isReactNative, getWindow } from './utils'

function getBrowserOS(): string | null {
Expand Down Expand Up @@ -32,8 +30,8 @@ function getBrowserOS(): string | null {
type PlatformMap = Record<string, 'Android' | 'Linux' | 'Windows' | 'macOS'>

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',
Expand Down

0 comments on commit 478f637

Please sign in to comment.