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

fix(ESM package): QueryComplexity import CJS module from GraphQL #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hqtoan94
Copy link

@hqtoan94 hqtoan94 commented May 3, 2024

fix #75

The conflict on the bi-module support of QueryComplexity and graphql has caused the issue. For now if user use ESM, it will load ESM build of query complexity package. But this line of code will load commonjs module of graphql instead of ESM as expected. And it cause the issue that's been mentioned in #75.

The approach here is to allow user's compiler/transpiler decide it should load commonjs or ESM when it reach this line of code: https://github.com/slicknode/graphql-query-complexity/blob/master/src/QueryComplexity.ts#L11-L12.

This can be replaced by import specified extensions once both QueryComplexity and graphql are fully ESM.

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 this pull request may close these issues.

Error Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm.
1 participant