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

Cannot find module 'graphql-request/build/esm/types' or its corresponding type declarations.ts #635

Closed
frederikhors opened this issue Dec 14, 2023 · 14 comments · Fixed by #636
Labels

Comments

@frederikhors
Copy link

Upgrading today from "@sveltejs/kit": "1.30.0" to "@sveltejs/kit": "2.0.0" and deleting node_modules and package-lock.json, if I run npm install on typescript check I get:

image

Cannot find module 'graphql-request/build/esm/types' or its corresponding type declarations.ts (2307)

Why?

What should I use for this?

@frederikhors
Copy link
Author

I tried with v7-next too, the problem is still there.

A workaround is to remove the exports from package.json.

@graffle-js graffle-js deleted a comment from frederikhors Dec 18, 2023
@jonkoops
Copy link
Collaborator

Likely what is happening here is that SvelteKit is respecting the exports field, this restricts the paths you can import to what is defined there. This helps prevent leaking private implementation details to the public API.

You should not be importing from a subpath of the module, instead import it directly from the module itself:

import { GraphQLResponse } from 'graphql-request';

@jonkoops jonkoops closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2023
@frederikhors
Copy link
Author

Dear @jonkoops, please reopen this issue. I tried everything, also the import you suggest:

import { GraphQLResponse } from 'graphql-request';

It's always an error!

image

@jonkoops
Copy link
Collaborator

Hmm, yeah you are right. It looks like we're currently not exporting these types. Re-opening.

@jonkoops jonkoops reopened this Dec 18, 2023
@frederikhors
Copy link
Author

As I wrote:

A workaround is to remove the exports from package.json.

@jonkoops
Copy link
Collaborator

A workaround is to remove the exports from package.json.

I'd rather fix the bug honestly.

@frederikhors
Copy link
Author

I'd rather fix the bug honestly.

Yeah, me too, but I don't know how.

@jonkoops
Copy link
Collaborator

This will be fixed by #636

@frederikhors
Copy link
Author

@jonkoops Are you going to release this in a patch version?

@jonkoops
Copy link
Collaborator

No, this will be part of the next major version. You can install the next version if you want to try it out.

@alnaranjo
Copy link

This is still happening on v 7.0.1 release a couple days ago

@jonkoops
Copy link
Collaborator

This is still happening on v 7.0.1 release a couple days ago

Are you importing from graphql-request directly, so no sub paths?

@Kerumen
Copy link

Kerumen commented May 13, 2024

Same for me, after upgrading to v7.0.1 I've got the following TS error:

Screenshot 2024-05-13 at 21 19 33

@jasonkuhrt
Copy link
Member

You're hitting this #845, it's a problem with your setup, not the library. I'll try to document it soon. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants