Skip to content

Commit

Permalink
Fix globalThis.process conflict in the browser (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiglesias93 committed Nov 6, 2022
1 parent 25ce11d commit 5133d6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -216,8 +216,10 @@ export default class Emittery {
}

static get isDebugEnabled() {
// In a browser environment, `globalThis.process` can potentially reference a DOM Element with a `#process` ID,
// so instead of just type checking `globalThis.process`, we need to make sure that `globalThis.process.env` exists.
// eslint-disable-next-line n/prefer-global/process
if (typeof globalThis.process !== 'object') {
if (typeof globalThis.process?.env !== 'object') {
return isGlobalDebugEnabled;
}

Expand Down

0 comments on commit 5133d6f

Please sign in to comment.