Skip to content

Package.json conditional exports points to non-existent files #163

Description

@IronGeek

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

unfetch/package.json

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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions