Skip to content
Discussion options

You must be logged in to vote

ArkType is ESM-only, no CommonJS build exists. Checking the published package directly confirms it: package.json has "type": "module", and the exports map only has a default condition (pointing at the ESM output) plus a custom ark-ts condition for direct TS resolution, there's no require condition anywhere in it. So require('arktype') will fail regardless of how you configure your project.

For NestJS specifically, that matters because Nest's default compiler output is CommonJS. You have two realistic options:

  • Use a dynamic import() inside your CJS Nest code to pull in ArkType at the call site. This works today with zero config changes and is the standard workaround for consuming an ESM-o…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by exzq12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants