remapping
remapping copied to clipboard
`exports` incompatible with TypeScript `"moduleResolution": "node16"`
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"
}