Add exports.types to package.json #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves https://github.com/codemirror/dev/issues/891
Codemirror is not able to compile since TypeScript 4.7 with
"moduleResolution": "node16"enabled, because it is unable to findtypesassociated with the ESM export,./dist/index.js. This PR adds the propertypesexport, which should be backwards compatible with both Node and TS runtimes.More context on that here and here.
I'm happy to submit PRs to all the other repos if this approach works. Thanks for the consideration!
@marijnh Any objections to pulling this in?
I've been holding off on this because node16 resolution is (was?) unstable and it seemed like this kind of breakage might be a temporary bug. But indeed, they seem to have made it worse in 4.9. The syntax used in this PR is different from what the announcement shows (though definitely less verbose, so in principle more palatable)—do we know for sure that this is going to keep working as they stabilize it? See also the apparently even different new resolution method in TypeScript 5. What I'd really like to avoid is to have these kinds of changes to all the CodeMirror packages every three weeks as TypeScript breaks or fixes or changes its oddly picky new resolution algorithms.
In May of 2022, a TypeScript dev commented that this behavior is on purpose, and they consider a missing
export.typesfield a packaging mistake.Please reconsider merging this? Not being able to use
node16is causing us pain trying to mix CJS and ESM modules together.This has been fixed in another way (making the type declaration file names correspond to TS's expectations).
So it is, looks like we were on an old version. Thanks!
Pull request closed