-
Notifications
You must be signed in to change notification settings - Fork 2k
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
graphql-js v16.7.0 breaks the compilation of SvelteKit #3920
Comments
I have the same error using vitejs |
Since I use SvelteKit with Vite, it could be a problem in conjunction with Vite and not SvelteKit. |
I think there is a solution to our problem 😄 |
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.
@docseltsam It's an issue with SvetleKit internals, but I added a workaround for it in |
I can confirm that the workaround added into |
I can also confirm that the workaround in |
I use graphql-js in a webapp using SvelteKit. After updating from version 16.6.0 to version 16.7.0 my app does not work anymore.
As far as I analyzed this correctly, the problem seems to be the change in src/jsutils/instanceOf.ts
from
to
SvelteKit seems to replace env.NODE_ENV by the string "development" or "production" on compiling the sources and that ends up in the following invalid code
the old version of instanceOf lead to this code
I don't know why this change was made so unfortunatly I don't really know how to fix this the best way. In my opionen it would by nice, if this part could be reversed to this old implementation.
The text was updated successfully, but these errors were encountered: