Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature detect if browser or node.js #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Feature detect if browser or node.js #85

wants to merge 1 commit into from

Conversation

mushishi78
Copy link

@calvinmetcalf
Copy link
Collaborator

this is the thing that's supposed to be adding the global.process, I'm not sure you can check against it for this module.

@mushishi78
Copy link
Author

mushishi78 commented Dec 29, 2018

This is not adding the process object to the global process variable, it's adding it to the export for this package. The purpose is so that if you want to be agnostic about whether you're in browser, you can rely on the import of this library being there but you can't rely on the global variable being there.

The reason I needed this is because I'm trying out a bundler that doesn't respect the "browser" field in the package.json. I saw that the linked debug library had used this fix in later versions to support this use case so I figured it was fair to give PR to do the same here.

Could also probably just do this if you prefer:

module.exports = global.process || require('./browser.js');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants