developit / developit/unfetch

Package.json conditional exports points to non-existent files

オープン
#163 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
5.7k
フォーク
204
PR マージ指標
30日以内にマージされた PR はありません

説明

The conditional exports in package.json points to files which does not exist:

https://github.com/developit/unfetch/blob/ee5810e7f9cd769677984b159d7e250adf4611b9/package.json#L16-L20

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 https://github.com/microsoft/TypeScript/issues/48235)

Therefore, I believe the correct exports should've been:
```json
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./dist/unfetch.mjs",
"default": "./dist/unfetch.js"
},
```

---
FWIW, I'm using `Typescript 4.9` with `moduleResolution": "NodeNext"`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。