Skip to content

Conversation

IvanGoncharov
Copy link
Member

@IvanGoncharov IvanGoncharov commented Jun 22, 2023

Big shout out to @phryneas, who managed to reproduce this issue and come up with this fix.

Fixes: #3919 #3920 #3921
Context: #3887 changed code and introced optinal chaining. globalThis.process?.env.NODE_ENV is transpiled into

(_globalThis$process = globalThis.process) === null ||
_globalThis$process === void 0
  ? void 0
  : _globalThis$process.env.NODE_ENV;

Bundlers incorrectly replace (probably RegExp) process.env.NODE_ENV with "development" resulting in:

(_globalThis$process = globalThis.process) === null ||
_globalThis$process === void 0
  ? void 0
  : _globalThis$"development";

Technically it's not a graphql issue but an issue with bundler but since it caused so much pain in comutinity this is an attempt to fix it within our codebase.

Fixes: #3919 #3920 #3921
Context: #3887 changed code and introced optinal chaining.
`globalThis.process?.env.NODE_ENV` is transpiled into
```
(_globalThis$process = globalThis.process) === null ||
_globalThis$process === void 0
  ? void 0
  : _globalThis$process.env.NODE_ENV;
```
Bundlers incorrectly replace (probably RegExp) `process.env.NODE_ENV` with `"development"` resulting in:
```
(_globalThis$process = globalThis.process) === null ||
_globalThis$process === void 0
  ? void 0
  : _globalThis$"development";
```

Technically it's not a graphql issue but an issue with bundler but since it caused so much pain in comutinity this is an attempt to fix it within our codebase.
@IvanGoncharov IvanGoncharov added the PR: bug fix 🐞 requires increase of "patch" version number label Jun 22, 2023
@github-actions
Copy link

Hi @IvanGoncharov, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@IvanGoncharov IvanGoncharov merged commit a08aaee into 16.x.x Jun 22, 2023
@IvanGoncharov IvanGoncharov deleted the fix_instanceOf branch June 22, 2023 16:57
IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request Sep 1, 2023
IvanGoncharov added a commit that referenced this pull request Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bug fix 🐞 requires increase of "patch" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant