fix: only access Node.js globals if available#3501
Conversation
|
The latest changes of this PR are available on NPM as Also you can depend on latest version built from this PR: |
✅ Deploy Preview for compassionate-pike-271cb3 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
yaacovCR
left a comment
There was a problem hiding this comment.
To better telegraph the intent in the changelog, you could make this 2 PRs, one updating the eslint with these settings, and a following one with the then-allowed addition of globalThis.
Or, you could rebase these changes into 2 commits that do exactly just that, and then the changes could not be squashed.
But in my meager opinion, that would be gravy and I also approve as is. :)
|
@n1ru4l please rebase : ) |
|
@saihaj done 🎉 |
Was added as part of graphql#3501
The
processobject is only available in Node.js and Node.js-like environments (e.g. webpack).By introducing this simple change, the code can run in a browser environment without requiring polyfilling Node.js APIs such as the following:
globalThisis part of the ECMA 2020 specification and is supported on any relevant platform.The eslint config specifies ecma version 2020 but it seems like the
globalThisis not automatically provided. I added thees2020env. (eslint/eslint#15199 (comment))Closes #2409