Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

exports incompatible with TypeScript "moduleResolution": "node16" #194

@HereIsKevin

Description

@HereIsKevin

Because the type declarations are .d.ts and the package does not have "type": "module", TypeScript assumes this package is CommonJS only despite having an ESM export when "moduleResolution": "node16" is used.

A potential fix could be changing exports include the following and creating a remapping.d.mts file identical to remapping.d.ts. This causes TypeScript to resolve to remapping.d.mts for ESM first and fallback to remapping.d.ts otherwise. This should not impact any build tools.

{
  "import": {
    "types": "./dist/types/remapping.d.mts",
    "default": "./dist/remapping.mjs"
  },
  "types": "./dist/types/remapping.d.ts",
  "browser": "./dist/remapping.umd.js",
  "require": "./dist/remapping.umd.js"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions