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
Hi @HarryCruse-Kaluza, thanks for opening this. That PR updated TypeScript as a dev dependency of dd-trace-js. TypeScript 7 removed the JavaScript compiler API used by some of our lint and test tooling, which is why that dependency update could not simply be merged.
I went on and quickly tested a package built from unchanged master, plus published dd-trace-js v5.128.0 and v6.17.0, in isolated projects using TypeScript 7.0.2. Strict type checks passed for the imports and module-resolution settings we tested.
If your project does fail, could you share the exact dd-trace-js and TypeScript versions, failing command and error, and tsconfig.json (or a minimal reproduction)? This would help us address any existing issue faster.
Ok, thanks for your reply 🙂 I tried to update my project to TS7 a while ago, and we hit a lot of failures with vitest that seemed to be caused by dd-trace. I'll try to run it again to get more info, but I might not have time until next week. I hope that's ok
node:internal/modules/esm/loader:337
throw new ERR_REQUIRE_CYCLE_MODULE(message);
^
Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /.../dd-trace-tsc-repro/node_modules/typescript/bin/tsc in a cycle. A cycle involving require(esm) is not allowed to maintain invariants mandated by the ECMAScript specification. Try making at least part of the dependency in the graph lazily loaded.
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:337:13)
at loadESMFromCJS (node:internal/modules/cjs/loader:1774:24)
at Module._compile (node:internal/modules/cjs/loader:1938:5)
at Object..js (node:internal/modules/cjs/loader:2096:10)
at Module.load (node:internal/modules/cjs/loader:1678:32)
at Module._load (node:internal/modules/cjs/loader:1470:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:376:15)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:248:9)
at ModuleJob.run (node:internal/modules/esm/module_job:569:25) {
code: 'ERR_REQUIRE_CYCLE_MODULE'
}
Node.js v26.10.0
But running the same steps with typescript@6.0.2 succeeds.
Note that even with TS7, running NODE_OPTIONS='--import dd-trace/register.js' node node_modules/typescript/lib/tsc.js --version does succeed.
In our CI we're setting NODE_OPTIONS='--import dd-trace/register.js --import dd-trace/ci/init.js' and then running our build & test command, so that Vitest results get uploaded to Datadog. We can work around it to some extent by running the build in a separate step from the tests, but it would be nice if that wasn't necessary. Thanks!
I did not yet look into it closer, but it does seem to be related to the dual module hazard happening with require(ESM). That applies to e.g., GraphQL, AWS SDK, and seemingly also here.
If it is about that, we have to find a solution for iitm / ritm for this @pabloerhard. I had a look at this before and have draft PRs open but they are outdated and ideally, we fix it not in dd-trace-js, but in the combined resolution one.
This appears to be a separate issue from the dual-module hazard. IITM overrides Node’s correctly resolved ESM format for extensionless entrypoints, which seems to affect TypeScript 7’s tsc launcher. I was able to reproduce @HarryCruse-Kaluza failure and I'm working on an upstream iitm fix.
Activity
pabloerhard commentedon Sep 28, 2026
Hi @HarryCruse-Kaluza, thanks for opening this. That PR updated TypeScript as a dev dependency of dd-trace-js. TypeScript 7 removed the JavaScript compiler API used by some of our lint and test tooling, which is why that dependency update could not simply be merged.
I went on and quickly tested a package built from unchanged master, plus published dd-trace-js v5.128.0 and v6.17.0, in isolated projects using TypeScript 7.0.2. Strict type checks passed for the imports and module-resolution settings we tested.
If your project does fail, could you share the exact dd-trace-js and TypeScript versions, failing command and error, and tsconfig.json (or a minimal reproduction)? This would help us address any existing issue faster.
HarryCruse-Kaluza commentedon Oct 1, 2026
Ok, thanks for your reply 🙂 I tried to update my project to TS7 a while ago, and we hit a lot of failures with vitest that seemed to be caused by dd-trace. I'll try to run it again to get more info, but I might not have time until next week. I hope that's ok
pabloerhard commentedon Oct 1, 2026
That works. Let us know if any failures still seem to be related to dd-trace-js so we can look into them!
HarryCruse-Kaluza commentedon Oct 5, 2026
Thanks for being patient! Here are the repro steps:
which gives this output:
But running the same steps with
typescript@6.0.2succeeds.Note that even with TS7, running
NODE_OPTIONS='--import dd-trace/register.js' node node_modules/typescript/lib/tsc.js --versiondoes succeed.In our CI we're setting
NODE_OPTIONS='--import dd-trace/register.js --import dd-trace/ci/init.js'and then running our build & test command, so that Vitest results get uploaded to Datadog. We can work around it to some extent by running the build in a separate step from the tests, but it would be nice if that wasn't necessary. Thanks!BridgeAR commentedon Oct 5, 2026
I did not yet look into it closer, but it does seem to be related to the dual module hazard happening with require(ESM). That applies to e.g., GraphQL, AWS SDK, and seemingly also here.
If it is about that, we have to find a solution for iitm / ritm for this @pabloerhard. I had a look at this before and have draft PRs open but they are outdated and ideally, we fix it not in dd-trace-js, but in the combined resolution one.
BridgeAR commentedon Oct 5, 2026
Related #10605
pabloerhard commentedon Oct 5, 2026
This appears to be a separate issue from the dual-module hazard. IITM overrides Node’s correctly resolved ESM format for extensionless entrypoints, which seems to affect TypeScript 7’s tsc launcher. I was able to reproduce @HarryCruse-Kaluza failure and I'm working on an upstream iitm fix.