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
fix: remove globalThis
check and align with what bundlers can accept
#4022
Open
JoviDeCroock
wants to merge
4
commits into
graphql:16.x.x
Choose a base branch
from
JoviDeCroock:fix-node-env-issue
base: 16.x.x
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benjie
approved these changes
Feb 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
JoviDeCroock
force-pushed
the
fix-node-env-issue
branch
3 times, most recently
from
February 14, 2024 14:16
a8f5b4a
to
b0ca7e0
Compare
CC @graphql/graphql-js-reviewers |
JoviDeCroock
commented
May 1, 2024
JoviDeCroock
commented
May 1, 2024
n1ru4l
approved these changes
May 2, 2024
JoviDeCroock
commented
May 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As surfaced in Discord this currently is a breaking change in the 16.x.x release line which is preventing folks from upgrading towards a security fix. This PR should result in a patch release on the 16 release line.
This change was originally introduced to support CFW and browser environments which should still be supported with the
typeof
check CC @n1ru4lThis also adds a check whether
.env
is present as in the DOM usingid="process"
defines that as a global which we don't want to access on accident. as shown in #4017Bundles also target
process.env.NODE_ENV
specifically which fails when it replacesglobalThis.process.env.NODE_ENV
as this becomesglobalThis."production"
which is invalid syntax.Fixes #3978
Fixes #3918
Fixes #3928
Fixes #3758
Fixes #3934
This purposefully does not account for #3925 as we can't address this without breaking CF/plain browsers so the small byte-size increase will be expected for bundled browser environments. As a middle ground we did optimise the performance here. We can revisit this for v17.
Most bundlers will be able to tree-shake this with a little help, in #4075 (comment) you can find a conclusion with a repo where we discuss a few.
process.env.NODE_ENV
you can addtypeof process
linearlyconfig.define
process.env.NODE_ENV
but does not support replacingtypeof process
Supersedes #4021
Supersedes #4019
Supersedes #3927