Error after upgrading from 16.6 to 16.8.1 with globalThis.process.env.NODE_ENV
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.
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: https://github.com/advisories/GHSA-9pv7-vfvm-6vr7
Having the same bug. It resolves to globalThis."development" === 'production' or production and it breaks the app.
Got the same issue when using the ReactJS framework, keeping graphql on 16.6.0 seems to be the solution for us for now.
Same issue here, with a Uncaught SyntaxError: missing name after . operator at runtime.
React project compiled with Vite.
Any plans for a fix?
Thanks
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
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)
})
see PR, this fixes the vue3, quasar, vite problem with graphql-js > 16.6
Hey,
Would anyone mind posting a reproduction to this issue leveraging vite/webpack/.... Does upgrading resolve the issue?
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.
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.
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
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.
Fixed with 16.8.2