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

Test if process is defined in browser #2676

Closed
pelikhan opened this issue Jun 26, 2020 · 3 comments
Closed

Test if process is defined in browser #2676

pelikhan opened this issue Jun 26, 2020 · 3 comments

Comments

@pelikhan
Copy link

Hello all!

First thanks for this very well written library. It's a breeze to work with it.

I am hitting a snag when compiling graphql into a ES6 library. The node.js process object is queried in a mjs file which crashes in the browser. It would be great to add a check to make sure process is defined.

export default process.env.NODE_ENV === 'production'

Thanks!

@IvanGoncharov
Copy link
Member

@pelikhan Thanks for taking the time to report it 👍
I have plan to remove process completely in the new major version and switch to having development and production build inside the NPM package similar to how it's done by React.

@schrotie
Copy link

Temporary workaround until this fix is in the release:

Import an ES module with this content before importing GraphQL:
window.process = {env: {}};

@yaacovCR
Copy link
Contributor

Closed by #3501

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

No branches or pull requests

4 participants