You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the following error when using "moduleResolution": "node16" with TypeScript:
node_modules/apollo-server-core/dist/types.d.ts:3:50 - error TS1471: 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.
3 import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/apollo-server-core/dist/types.d.ts:3
This can be reproduced like so:
index.ts
import{ApolloServer}from'apollo-server';constserver=newApolloServer({csrfPrevention: true,cache: 'bounded',});const{ url }=awaitserver.listen();console.log(`🚀 Server ready at ${url}`);
$ tsc
node_modules/apollo-server-core/dist/types.d.ts:3:50 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@graphql-tools/schema")' call instead.
3 import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/apollo-server-core/dist/types.d.ts:3
I'm getting the following error when using
"moduleResolution": "node16"
with TypeScript:This can be reproduced like so:
index.ts
package.json
tsconfig.json
Then when running
tsc
:Related reading:
compilerOptions.module
set tonodenext
due to imports missing file extensions apollo-client#9890moduleResolution: nodenext
TS users (v4) #6731The text was updated successfully, but these errors were encountered: