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

Error after upgrading from 16.6 to 16.8.1 with globalThis.process.env.NODE_ENV #3978

Open
DontRepeatYourself opened this issue Oct 12, 2023 · 12 comments · May be fixed by #4021
Open

Error after upgrading from 16.6 to 16.8.1 with globalThis.process.env.NODE_ENV #3978

DontRepeatYourself opened this issue Oct 12, 2023 · 12 comments · May be fixed by #4021

Comments

@DontRepeatYourself
Copy link

DontRepeatYourself commented Oct 12, 2023

Running a project with Vue3 / Quasar2 / Vite in development mode fails after update.

// node_modules/graphql/jsutils/instanceOf.mjs
globalThis.process && globalThis.process.env.NODE_ENV === 'production'

is compiled to

var instanceOf = globalThis.process && globalThis."development" === "production" ? function instanceOf2(value, constructor) { ... }

Changing

globalThis.process && globalThis.process.env.NODE_ENV === 'production'

to

globalThis.process && globalThis.process.env['NODE_ENV'] === 'production'

solves the problem for me.

@vdineva
Copy link

vdineva commented Oct 12, 2023

Experiencing the same issue and this bug does not allow us to upgrade to the latest version and there's a security advisory for versions before 16.8.1: GHSA-9pv7-vfvm-6vr7

@rafaelsorto
Copy link

Having the same bug. It resolves to globalThis."development" === 'production' or production and it breaks the app.

@MaLiN2223
Copy link

MaLiN2223 commented Oct 28, 2023

Got the same issue when using the ReactJS framework, keeping graphql on 16.6.0 seems to be the solution for us for now.

@TdyP
Copy link

TdyP commented Dec 4, 2023

Same issue here, with a Uncaught SyntaxError: missing name after . operator at runtime.
React project compiled with Vite.

Any plans for a fix?

Thanks

arthuravianna added a commit to prototyp3-dev/cartesi-client that referenced this issue Dec 18, 2023
The newest versions of the package presented a bug as for this issue graphql/graphql-js#3978.
@vdineva
Copy link

vdineva commented Jan 4, 2024

Just checking on the status of this issue. Is there a plan to address it and publish a new version? It's been open for a while now

@vdineva
Copy link

vdineva commented Feb 12, 2024

For anyone experiencing issues with v16.8.1, a workaround is to define globalThis.process.env.NODE_ENV in your bundler.
For Webpack it's:

new DefinePlugin({
   "globalThis.process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
})

This was referenced Feb 13, 2024
@mobsean
Copy link

mobsean commented Feb 13, 2024

see PR, this fixes the vue3, quasar, vite problem with graphql-js > 16.6

@JoviDeCroock
Copy link

Hey,

Would anyone mind posting a reproduction to this issue leveraging vite/webpack/.... Does upgrading resolve the issue?

@mobsean
Copy link

mobsean commented Feb 15, 2024

Hey,

Would anyone mind posting a reproduction to this issue leveraging vite/webpack/.... Does upgrading resolve the issue?

I checked your PR and fine with it. The problem in this issue is solved by this.

@n05la3
Copy link

n05la3 commented Feb 15, 2024

Hey,

Would anyone mind posting a reproduction to this issue leveraging vite/webpack/.... Does upgrading resolve the issue?

Tested with vite and it works fine.

@JoviDeCroock
Copy link

What did you test @n05la3 the PR or whether the issue is present 😅 we need versions/... actual reproductions or at the very least version numbers of where this issue shows itself

@n05la3
Copy link

n05la3 commented Feb 15, 2024

I misread the comment. I experienced this issue in a Quasar 2.14.3 project with Vite 5.0.0 when upgrading from 16.6.0 to 16.8.1. I had used a patch to bypass this issue. Earlier today, I tested the changes in the PR in my project and it works fine.

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 a pull request may close this issue.

8 participants