Skip to content

Not valid ESM typings #383

@Arilas

Description

@Arilas

Your package has single "types" entry in your package.json, you should have something like:

"exports": {
    ".": {
      "import": {
        "types": "./dist/index.d.mts",
        "default": "./src/index.mts"
      },
      "require": {
        "types": "./dist/index.d.ts",
        "default": "./src/index.mts"
      }
    }
  },

Also, your typing information is not valid ESM, because it uses relative imports without extensions, so TypeScript ignores those imports. Example of error:

Image

The easiest fix would be to replace custom rollup config with tsup, and adding format: ['esm', 'cjs'], dts: true to tsup config.

Metadata

Metadata

Assignees

Labels

bugIndicates a reported issue or malfunction that needs fixing.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions