Skip to content

Uncaught ReferenceError: process is not defined #369

Answered by enisdenjo
thojanssens asked this question in Q&A
Discussion options

You must be logged in to vote

graphql is a peer dependency of graphql-ws, it is necessary for proper functioning of the library and therefore cannot be optional.

Furthermore, seems like this has already been fixed with graphql/graphql-js#3501, but not released as of now.

Until it gets released, I'd go with appending the recommended polyfil in your index.html:

<script>
  window.process = globalThis.process = {
    env: {
      NODE_ENV: "development" // or "production", depending on your environment
    }
  };
</script>

or by making your bundler replace all instances of process.env.NODE_ENV === 'production' with true/false.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by enisdenjo
Comment options

You must be logged in to vote
4 replies
@enisdenjo
Comment options

@thojanssens
Comment options

@enisdenjo
Comment options

@thojanssens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #368 on June 13, 2022 09:02.