-
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
Are The Types Wrong lists the issue "Masquerading as ESM" for the regex package.
I guess the issue lies in package exports field, it only lists a single type definition file but an .mjs and a .cjs source for ESM and CJS respectively. Newer TS versions would need two definitions .d.mts and .d.cts. I believe they can generally be identical. There's some edge case import/export syntax only available in .cts files:
https://www.typescriptlang.org/docs/handbook/modules/reference.html#export--and-import--require
I haven't tested it, but I believe rewriting the exports field to something like this could work:
{
"exports": {
".": {
"import": {
"types": "./dist/regex.d.mts",
"default": "./dist/regex.mjs"
},
"require": {
"types": "./dist/regex.d.cts",
"default": "./dist/regex.cjs"
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels