This package can't be used in a node environment using ESM as it's neither declared as "type": "module" nor does it include .mjs extensions for the files in the module main field.
Since TSC is not able to produce proper ESM files with .mjs extensions I opted to use tsup to compile the ESM files, and I also had to add @swc/core to keep this backwards compatible with the es5 target. I don't think there's much point in supporting back to es5 for an ESM, but I'm keeping it for now to avoid making this a breaking change.
Fixes #2353
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change(fix or feature that would cause existing functionality to not work as before)
Description
This package can't be used in a node environment using ESM as it's neither declared as
"type": "module"
nor does it include.mjs
extensions for the files in themodule
main field.Since TSC is not able to produce proper ESM files with
.mjs
extensions I opted to usetsup
to compile the ESM files, and I also had to add@swc/core
to keep this backwards compatible with thees5
target. I don't think there's much point in supporting back to es5 for an ESM, but I'm keeping it for now to avoid making this a breaking change.Fixes #2353
Type of change
Checklist
yarn test
)yarn lint
). Fix it withyarn lint:fix
in case of failure.yarn lint:types
).