arktypea
arktype5mo ago
Blitz

Trying to use Arktype with nestjs module problems

I don't undestand why i'm getting problems with
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/kordian/Projects/kindora-backend/node_modules/.pnpm/arktype@2.1.20/node_modules/arktype/out/index.js from /Users/kordian/Projects/kindora-backend/dist/src/database/pagination.types.js not supported.
Instead change the require of index.js in /Users/kordian/Projects/kindora-backend/dist/src/database/pagination.types.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/kordian/Projects/kindora-backend/dist/src/database/pagination.types.js:4:19) {
  code: 'ERR_REQUIRE_ESM'
}


I'm using this tsconfig
{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "esModuleInterop": true,
    "isolatedModules": true,
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2023",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "noFallthroughCasesInSwitch": false,
  }
}


Whenever I switch my module to esnext all the imports no longer are working
Was this page helpful?