Patch Changes
-
e2cb9c7: Serve CJS type declarations to CJS consumers.
The
exportsmap carried one top-leveltypespointing at./esm/index.d.ts, and norequirecondition. A CommonJS consumer resolving undernode16/nodenextwas therefore handed the ESM declarations and told the package was ESM, failing withTS1479: the referenced file is an ECMAScript module and cannot be imported with 'require'.Nothing was wrong with the emitted code —
cjs/package.jsonalready declares{"type":"commonjs"}andcjs/index.d.tsalready shipped. The manifest simply never pointed at it.moduleResolution: "node"ignoresexportsmaps entirely, which is why this went unnoticed.exportsnow resolvesrequireandimportseparately, each with the declarations that match its format, and the top-leveltypesagrees withmaininstead of contradicting it.