Skip to content

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

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

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

hqtoan94
Copy link
Contributor

@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.

@ivome
Copy link
Collaborator

ivome commented Jun 10, 2024

Thanks for investigating and fixing this!

@ivome ivome merged commit 439a3a9 into slicknode:master Jun 10, 2024
5 checks passed
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.
2 participants