-
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
Terser also causes #1182, Cannot use e "__Schema" from another module or realm #2523
Comments
Working with Sapper and Temporarily fixed by building with |
This is an answer: https://stackoverflow.com/a/59289399/10088259. Can we find and fix this |
I "fixed" it with the following patch-package: graphql+14.6.0.patch diff --git a/node_modules/graphql/jsutils/instanceOf.js b/node_modules/graphql/jsutils/instanceOf.js
index 8631fd1..6eddbc3 100644
--- a/node_modules/graphql/jsutils/instanceOf.js
+++ b/node_modules/graphql/jsutils/instanceOf.js
@@ -25,6 +25,8 @@ function instanceOf(value, constructor) {
var className = constructor.name;
if (className && valueClass && valueClass.name === className) {
+ console.warn('Graphql #1182 warning');
+ return true;
throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
}
}
diff --git a/node_modules/graphql/jsutils/instanceOf.js.flow b/node_modules/graphql/jsutils/instanceOf.js.flow
index 967969a..dfdb390 100644
--- a/node_modules/graphql/jsutils/instanceOf.js.flow
+++ b/node_modules/graphql/jsutils/instanceOf.js.flow
@@ -25,6 +25,8 @@ export default process.env.NODE_ENV === 'production'
const valueClass = value.constructor;
const className = constructor.name;
if (className && valueClass && valueClass.name === className) {
+ console.warn('Graphql #1182 warning')
+ return true
throw new Error(
`Cannot use ${className} "${value}" from another module or realm.
diff --git a/node_modules/graphql/jsutils/instanceOf.mjs b/node_modules/graphql/jsutils/instanceOf.mjs
index eeea88d..dd11457 100644
--- a/node_modules/graphql/jsutils/instanceOf.mjs
+++ b/node_modules/graphql/jsutils/instanceOf.mjs
@@ -18,6 +18,8 @@ function instanceOf(value, constructor) {
var className = constructor.name;
if (className && valueClass && valueClass.name === className) {
+ console.warn('Graphql #1182 warning');
+ return true;
throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
}
}
|
Do you think it's just a matter of errors? Maybe there is something wrong with the compilation phase. And I don't want anything useless or, worse, harmful to end up in the final bundle. |
Please ensure you don't have duplicate
|
@IvanGoncharov I think this should stay open, people are encountering it and I can confirm this still occurs when only one |
DONE Still the problem. Please re-open it. |
I was able to work around this by setting |
The only time this error is thrown is when an instance of a type, directive or schema isn't an instance of the class exported by the That said, there may be other ways to break your code and trigger the error -- for example, by creating a shallow clone of the instance in question. Disabling this check is generally a bad idea because it can potentially lead to unexpected behavior or even more cryptic error messages. If you're still encountering this issue, and you're certain it's not a problem with your dependencies, then it's most likely either an issue with your code or another library you're using. If you put together a minimum working example of the issue in the form or a repo or code sandbox, I can try to help you isolate the code that's causing the issue. However, requests for debugging help should really be posted elsewhere, like SO, reddit or the official Slack channel. |
this error currently happens with @apollo/client 3.0.0 even if you don't use graphql directly in your project and even if you have only one version of graphql in your yarn.lock |
still happens, I'm still investigating but it seems to have something to do with code-splitting (so not really an issue of this package but something is probably causing it to misbehave) and yes, if minify is disabled, it works fine |
Still having this issue as well, despite that we only have one version of graphql as well. Help needed! |
@ramiAbdou ok in our case it was because aws-amplify had its own graphql bundled inside, check all of your deps it might be similar issue (but the rest was true, it was issue only when minified) |
Still seeing this issue as well on |
We had a very old graphql version. To avoid this issue temporarily we took the following steps
|
In reference to #1182, it seems that this is not fixed with Terser. I just ran into the problem again today.
Has anyone else been working on or experiencing this?
The text was updated successfully, but these errors were encountered: