-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
The conditional exports in package.json points to files which does not exist:
Lines 16 to 20 in ee5810e
| "exports": { | |
| ".": { | |
| "import": "./index.mjs", | |
| "default": "./index.js" | |
| }, |
This causes the following errors when importing unfetch with typescript:
Cannot find module 'unfetch' or its corresponding type declarations.ts(2307)
Also, if you're declaring conditional exports and have type declarations (d.ts) in different location, I think you need to add "types" as the first export condition (see: https://www.typescriptlang.org/docs/handbook/esm-node.html, and microsoft/TypeScript#48235)
Therefore, I believe the correct exports should've been:
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./dist/unfetch.mjs",
"default": "./dist/unfetch.js"
},FWIW, I'm using Typescript 4.9 with moduleResolution": "NodeNext"
thtmnisamnstr, looch and jsundqvist
Metadata
Metadata
Assignees
Labels
No labels