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

Using within typescript project #1

Closed
mydnicq opened this issue Aug 8, 2017 · 3 comments
Closed

Using within typescript project #1

mydnicq opened this issue Aug 8, 2017 · 3 comments

Comments

@mydnicq
Copy link

mydnicq commented Aug 8, 2017

Thank you for this awesome package, which I'm sure it'll become an important part in every graphql server written in Javascript.

I have a graphql server based on Apollo Server and the whole project is written in TypeScript. For running the server I use ts-node.

The problem I have is when I make a query, I always get 'Query Complexity of 0'. Then I made a custom Typescript module to where I copied the graph-query-complexity code with small modifications regarding only the type definitions. With this module, the Query Complexity is calculated as it should.

I'm not sure if this is a problem of the package or the fact that I'm using Typescript with ts-node.

Any help would be more than welcome.

@mydnicq
Copy link
Author

mydnicq commented Aug 9, 2017

After doing some more investigation, I found that the problem isn't in using Apollo Server nor in ts-node, but how graphql module is included in the project.

In your module package.json, the graphql module is defined as dependency. My project also has graphql module as dependency and creators of graphql stated that there should be only one graphql module per project. After removing graphql module from your package's node_modules, everything works.

So I recommend that you change graphql moduledependency to peerDependency.

ivome added a commit that referenced this issue Aug 10, 2017
@ivome
Copy link
Collaborator

ivome commented Aug 10, 2017

Thanks for reporting and investigating the issue. I just released a new version with that change. Could you check if that solved the problem?

@mydnicq
Copy link
Author

mydnicq commented Aug 10, 2017

Yes it is solved. Thank you!

@mydnicq mydnicq closed this as completed Aug 10, 2017
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

No branches or pull requests

2 participants