Module '@graphql-tools/schema' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead.ts(1471) #4581
Replies: 2 comments 10 replies
-
Hey @purrplingcat, do you think you can provide a minimal reproduction of this issue as a GitHub repository? As far as I know, we conform with the exports map as required by TypeScript ( I quickly tried this (using yarn@1) and everything seems to work as expected: https://github.com/n1ru4l/graphql-tools-schema-node16-repro We are not that versed in PNPM, to exclude that this is a pnpm issue can you please test whether the same issue also occurs when using yarn v1 or npm? |
Beta Was this translation helpful? Give feedback.
-
We're having this issue as well, only with @graphql-tools/* packages. Maybe it has something to do with ordering in the package.json? microsoft/TypeScript#49299 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using graphql-tools in my propject with typescript which uses module resolution node16 in my tsconfig.ts. I am using yarn PnP instead of standard node_modules.
If I use the
node
module resolution, it works, but I can't use my exports in package.json in my other projects in workspace. When I usenode16
as module resolution, I can use my exports, but I can't use the grpah-ql tools, because i got:It is just TypeScript error, if I use node's
require()
it works. If I try to rewrite it to dynamic import, it fails due to PnP and dynamic import in node requires full-qualified name including suffix:and that looks pretty awful.
How can I force TypeScript to use standard import (synchronyous) to import
@graphql-tools/schema
? ThanksBeta Was this translation helpful? Give feedback.
All reactions