-
Notifications
You must be signed in to change notification settings - Fork 41
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 Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm. #75
Comments
I'm also facing the same issue. I'm guessing the problem is affecting all people that have their application built as esm (for example in my case, I'm using But I think it is a requirement for esm to specify the file extensions, so I think that's why it was there in the first place. So, what I ended up doing was creating an additional step after the build to replace ^ @slicknode is this something you would consider merging into your repo? |
@andresusanto I don't see any issue to remove the file extensions, it's a serverside module https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import |
I'm not quite sure what you meant by "serverside module", but perhaps check this one out? |
@andresusanto you are right. Relative and absolute specifiers must have a file extension (in the build directories) but this does not apply to bare specifiers. So graphql module should be imported without a file extension. Do you agree ? |
@andresusanto it looks like this is a general issue with the ESM version of this library, so it is probably a good idea to fix this here. We just have to make sure we are not breaking things for particular |
thanks @ivome, I've confirmed that earlier v14 versions don't have the |
Any update on this issue ? I am facing the same problem with my graphql scalars. I tried to use your own version of the library @andresusanto but it still raises the same issue: I also tried to simply copy paste the code in my codebase while removing the .js extension in the import but I got the same problem. |
Having the same issue.
Anyone managed to solve this? I have tried the |
Can confirm have managed to get rid of the error by removing |
hi @ivome , would you mind reviewing the PR above for the resolution? The idea is to keep it run without the extension so the user could config on their end to use their expected module type from both graphql-query-complexity and graphqljs |
I face this error. It seems due to the presence of extensions in import file names.
The library generating my schema uses ".mjs" files of graphql module, whereas graphql-query-complexity uses ".js" ones, and so graphql module believe that there are 2 different versions of it used.
For instance:
should be replaced with
The text was updated successfully, but these errors were encountered: