Closed gunters63 closed 2 years ago
Would you like to send a Pull Request to address this?
just released v6.1.7
That fixed the problem! Thanks :)
Yes, sorry. Missed that before.
The types entry should be the first one in the exports.
When I hacked directly in the package.json it worked, but other tools insist on the correct order I suppose :)
š Bug Report
types entries missing in package exports
To Reproduce
For projects using Typescript >= 4.7 AND Node resolution Node16/Nodenext the types fail to load with the message:
This can be reproduced with a minimal project using Typescript >= 4.7 and
"moduleResolution": "Node16",
in the tsconfig.json configuration file.Expected behavior
Typescript types should load.
The cause seems to be that the types property is missing from the module exports:
The correct ones would be:
The reason seems to be that the Typescript compiler (starting from 4.7) uses the exports fields to find the type declaration files and there is no fall back to the package.json
"types"
property when they are missing.See also: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#esm-nodejs