I'm writing a NodeJS backend for an application. It uses graphql and graphql-yoga. The application runs fine using tsx, but when I attempt to build the application I get several instances of this error (from different .cts files in that same folder):
node_modules/@graphql-yoga/subscription/typings/operator/map.d.cts:1:26
- 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("@repeaterjs/repeater")' call instead.
1 import { Repeater } from '@repeaterjs/repeater';
Is there a way to adjust my compiler options or something to fix this?
tsconfig.json:
{
"compilerOptions": {
"esModuleInterop": true,
"isolatedModules": true,
"module": "Node16",
"moduleResolution": "Node16",
"allowSyntheticDefaultImports" : true,
"useUnknownInCatchVariables": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2020",
},
"type": "module",
"compileOnSave": true,
"paths": {
},
"include": [
"./src/**/*.ts",
"./src/**/*.d.ts",
"./test/**/*.ts",
"./test/**/*.d.ts",
"index.ts",
"./.eslintrc.js",
"./jest.config.js",
]
}