-
Couldn't load subscription status.
- Fork 1.8k
Closed
Labels
type/debtTechnical debt that could slow us down in the long runTechnical debt that could slow us down in the long run
Milestone
Description
node v21.0.0 introduces the navigator object where it used to be undefined.
Which causes issues in src/common/Platform.ts:
export const isNode = (typeof navigator === 'undefined') ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform;
export const isFirefox = userAgent.includes('Firefox');There was discussion on whether using navigator to detect node here: nodejs/node#47769 (comment) but ultimately they concluded that since Deno has introduced a navigator object, so can node.
I often see checks like this instead:
const isNode = (typeof process !== 'undefined');
// or
const isNode = (typeof global !== 'undefined');which will work for v21 and below.
kkocdko
Metadata
Metadata
Assignees
Labels
type/debtTechnical debt that could slow us down in the long runTechnical debt that could slow us down in the long run